Fix some issues with resolving paths for a packaged single executable

This commit is contained in:
Veronica K. B. Olsen
2021-02-08 09:44:10 +01:00
parent f5588f94db
commit ada99077a4
3 changed files with 8 additions and 5 deletions
+5 -2
View File
@@ -272,8 +272,11 @@ class Config:
self.appPath = getattr(sys, "_MEIPASS", os.path.abspath(os.path.dirname(__file__))) self.appPath = getattr(sys, "_MEIPASS", os.path.abspath(os.path.dirname(__file__)))
self.appRoot = os.path.abspath(os.path.join(self.appPath, os.path.pardir)) self.appRoot = os.path.abspath(os.path.join(self.appPath, os.path.pardir))
if self.appRoot.endswith(".pyz"): if os.path.isfile(self.appRoot):
self.appRoot = os.path.abspath(os.path.join(self.appRoot, os.path.pardir)) # novelWriter is packaged as a single file, so the app and
# root paths are the same, and equal to the folder that
# contains the single executable.
self.appRoot = os.path.dirname(self.appRoot)
self.appPath = self.appRoot self.appPath = self.appRoot
# Assets # Assets
+1 -1
View File
@@ -203,7 +203,7 @@ class GuiTheme:
return return
def updateFont(self): def updateFont(self):
"""Updated the GUI's font style from settings, """Update the GUI's font style from settings.
""" """
theFont = QFont() theFont = QFont()
if self.mainConf.guiFont not in self.guiFontDB.families(): if self.mainConf.guiFont not in self.guiFontDB.families():
+2 -2
View File
@@ -402,7 +402,7 @@ def makeSimplePackage(embedPython):
print("Writing: __main__.py") print("Writing: __main__.py")
with open(os.path.join(zipDir, "__main__.py"), mode="w") as outFile: with open(os.path.join(zipDir, "__main__.py"), mode="w") as outFile:
outFile.write( outFile.write(
"#!\"pythonw.exe\"\n" "#!/usr/bin/env python3\n"
"\n" "\n"
"import os\n" "import os\n"
"import sys\n" "import sys\n"
@@ -419,7 +419,7 @@ def makeSimplePackage(embedPython):
print("") print("")
pyzFile = os.path.join(outDir, "novelWriter.pyz") pyzFile = os.path.join(outDir, "novelWriter.pyz")
zipapp.create_archive(zipDir, target=pyzFile, interpreter="python3") zipapp.create_archive(zipDir, target=pyzFile, interpreter="/usr/bin/env python3")
# Install Dependencies # Install Dependencies
# ==================== # ====================