diff --git a/kcc.py b/kcc.py index eb00c59..67db9d6 100755 --- a/kcc.py +++ b/kcc.py @@ -46,7 +46,8 @@ if sys.platform.startswith('darwin'): 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): diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index 1a307a2..0ffc55d 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -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 @@ -859,6 +860,12 @@ class KCCGUI(KCC_ui.Ui_mainWindow): self.addMessage('Your KindleGen' ' 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"KindleGen Found: {locations[0]}", 'info') else: self.kindleGen = False if startup: