mirror of
https://github.com/ciromattia/kcc
synced 2026-06-06 22:53:30 +00:00
linux search for kindlegen in ~/.local/bin for steam deck and more (#786)
* on steam deck, search for kindlegen in ~/.local/bin * remove comment
This commit is contained in:
@@ -18,16 +18,17 @@
|
|||||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import platform
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
if sys.version_info < (3, 8, 0):
|
if sys.version_info < (3, 8, 0):
|
||||||
print('ERROR: This is a Python 3.8+ script!')
|
print('ERROR: This is a Python 3.8+ script!')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# OS specific workarounds
|
if platform.system() == 'Darwin':
|
||||||
import os
|
|
||||||
if sys.platform.startswith('darwin'):
|
|
||||||
# prioritize KC2 since it optionally also installs KP3
|
|
||||||
mac_paths = [
|
mac_paths = [
|
||||||
'/Applications/Kindle Comic Creator/Kindle Comic Creator.app/Contents/MacOS',
|
'/Applications/Kindle Comic Creator/Kindle Comic Creator.app/Contents/MacOS',
|
||||||
'/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/',
|
'/Applications/Kindle Previewer 3.app/Contents/lib/fc/bin/',
|
||||||
@@ -45,8 +46,23 @@ if sys.platform.startswith('darwin'):
|
|||||||
else:
|
else:
|
||||||
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths)
|
os.environ['PATH'] += os.pathsep + os.pathsep.join(mac_paths)
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
elif sys.platform.startswith('win'):
|
|
||||||
# prioritize KC2 since it optionally also installs KP3
|
elif platform.system() == 'Linux':
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
os.environ['PATH'] += os.pathsep + os.pathsep.join(
|
||||||
|
[
|
||||||
|
str(Path.home() / ".local" / "bin"),
|
||||||
|
'/opt/homebrew/bin',
|
||||||
|
'/usr/local/bin',
|
||||||
|
'/usr/bin',
|
||||||
|
'/bin',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
|
||||||
|
else:
|
||||||
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
elif platform.system() == 'Windows':
|
||||||
win_paths = [
|
win_paths = [
|
||||||
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\KC2'),
|
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\KC2'),
|
||||||
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\'),
|
os.path.expandvars('%LOCALAPPDATA%\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\'),
|
||||||
@@ -64,12 +80,7 @@ elif sys.platform.startswith('win'):
|
|||||||
else:
|
else:
|
||||||
os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths)
|
os.environ['PATH'] += os.pathsep + os.pathsep.join(win_paths)
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
# Load additional Sentry configuration
|
|
||||||
# if getattr(sys, 'frozen', False):
|
|
||||||
# try:
|
|
||||||
# import kindlecomicconverter.sentry
|
|
||||||
# except ImportError:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
from multiprocessing import freeze_support, set_start_method
|
from multiprocessing import freeze_support, set_start_method
|
||||||
from kindlecomicconverter.startup import start
|
from kindlecomicconverter.startup import start
|
||||||
|
|||||||
Reference in New Issue
Block a user