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:
3
kcc.py
3
kcc.py
@@ -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):
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user