1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-15 18:56:28 +00:00

Display kindlegen path (#571)

* add %LOCALAPPDATA%\\Amazon\\KC2

* fix kindlegen link

* expandvars

* remove link

* print where kindlegen

* adjust where command

* remove platform
This commit is contained in:
Alex Xu
2023-08-07 10:53:38 -07:00
committed by GitHub
parent f73d889b6e
commit 77afa77d32
2 changed files with 9 additions and 1 deletions

3
kcc.py
View File

@@ -46,7 +46,8 @@ if sys.platform.startswith('darwin'):
os.chdir(os.path.dirname(os.path.abspath(__file__))) os.chdir(os.path.dirname(os.path.abspath(__file__)))
elif sys.platform.startswith('win'): elif sys.platform.startswith('win'):
win_paths = [ 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', 'C:\\Program Files\\7-Zip',
] ]
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):

View File

@@ -19,6 +19,7 @@
import json import json
import os import os
import re import re
import subprocess
import sys import sys
from urllib.parse import unquote from urllib.parse import unquote
from urllib.request import urlretrieve, urlopen from urllib.request import urlretrieve, urlopen
@@ -859,6 +860,12 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
self.addMessage('Your <a href="https://www.amazon.com/b?node=23496309011">KindleGen</a>' self.addMessage('Your <a href="https://www.amazon.com/b?node=23496309011">KindleGen</a>'
' is outdated! MOBI conversion might fail.', 'warning') ' is outdated! MOBI conversion might fail.', 'warning')
break 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: else:
self.kindleGen = False self.kindleGen = False
if startup: if startup: