Skip to content

Commit

Permalink
Display kindlegen path (#571)
Browse files Browse the repository at this point in the history
* add %LOCALAPPDATA%\\Amazon\\KC2

* fix kindlegen link

* expandvars

* remove link

* print where kindlegen

* adjust where command

* remove platform
  • Loading branch information
axu2 authored Aug 7, 2023
1 parent f73d889 commit 77afa77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
os.chdir(os.path.dirname(os.path.abspath(__file__)))
elif sys.platform.startswith('win'):
win_paths = [
'%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\',
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\'),
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\KC2'),
'C:\\Program Files\\7-Zip',
]
if getattr(sys, 'frozen', False):
Expand Down
7 changes: 7 additions & 0 deletions kindlecomicconverter/KCC_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import json
import os
import re
import subprocess
import sys
from urllib.parse import unquote
from urllib.request import urlretrieve, urlopen
Expand Down Expand Up @@ -859,6 +860,12 @@ def detectKindleGen(self, startup=False):
self.addMessage('Your <a href="https://www.amazon.com/b?node=23496309011">KindleGen</a>'
' is outdated! MOBI conversion might fail.', 'warning')
break
where_command = 'where kindlegen.exe'
if os.name == 'posix':
where_command = 'which kindlegen'
process = subprocess.run(where_command, stdout=PIPE, stderr=STDOUT, stdin=PIPE, shell=True)
locations = process.stdout.decode('utf-8').split('\n')
self.addMessage(f"<b>KindleGen Found:</b> {locations[0]}", 'info')
else:
self.kindleGen = False
if startup:
Expand Down

0 comments on commit 77afa77

Please sign in to comment.