1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 01:36:27 +00:00

Add 7z and Kindle Previewer 3 to PATH in all scenarios (#560)

* add 7z and KP3 to path
---------

Co-authored-by: darodi <4682830+darodi@users.noreply.github.com>
This commit is contained in:
Alex Xu
2023-07-25 12:27:56 -07:00
committed by GitHub
parent a5202458dc
commit 531cea88e6

31
kcc.py
View File

@@ -27,22 +27,37 @@ if sys.version_info < (3, 8, 0):
# OS specific workarounds
import os
if sys.platform.startswith('darwin'):
mac_paths = [
'/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/',
'/Applications/Kindle Comic Creator/Kindle Comic Creator.app/Contents/MacOS',
]
if getattr(sys, 'frozen', False):
os.environ['PATH'] = os.path.dirname(os.path.abspath(sys.executable)) + \
'/../Resources:/Applications/Kindle Comic Creator/Kindle Comic Creator.app/Contents/MacOS:' \
'/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/:/usr/local/bin:/usr/bin:/bin'
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths +
[
os.path.dirname(os.path.abspath(sys.executable)) + '/../Resources',
'/usr/local/bin',
'/usr/bin',
'/bin',
]
)
os.chdir(os.path.dirname(os.path.abspath(sys.executable)) + '/../Resources')
else:
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
elif sys.platform.startswith('win'):
win_paths = [
'%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\',
'C:\\Program Files\\7-Zip',
]
if getattr(sys, 'frozen', False):
os.environ['PATH'] = '%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\;' + \
os.environ['PATH']
os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths)
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
else:
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/windows/;' \
'%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\;' + \
os.environ['PATH']
os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths +
[
os.path.dirname(os.path.abspath(__file__)) + '/other/windows/',
]
)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# Load additional Sentry configuration
# if getattr(sys, 'frozen', False):