Fix issues with relative paths when scripts are packaged into binaries.

This commit is contained in:
2024-11-15 15:47:59 -07:00
parent 1219c2f974
commit 19615a8b34
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ build-cli:
source venv/bin/activate && pyinstaller --onefile --icon=wrenchIcon.ico solderPacker.py
build-gui:
source venv/bin/activate && pyinstaller --windowed --onefile --icon=wrenchIcon.ico solderPackerGUI.py
source venv/bin/activate && pyinstaller --windowed --onefile --icon=wrenchIcon.ico --add-data="wrenchIcon.ico:." solderPackerGUI.py
clean:
- rm -r venv
+5 -5
View File
@@ -16,14 +16,14 @@ from solderPacker import SolderPacker
# Globals
config = {}
base_path = os.path.dirname(os.path.realpath(__file__))
base_path = os.path.dirname(__file__)
class Form(QtW.QMainWindow):
def __init__(self):
QtW.QMainWindow.__init__(self)
self.setMinimumSize(400, 500)
self.setWindowIcon(QtG.QIcon(f"{base_path}{os.sep}wrenchIcon.ico"))
self.setWindowIcon(QtG.QIcon(os.path.join(base_path, "wrenchIcon.ico")))
self.setWindowTitle("Solder Packer")
self.thread_pool = QtC.QThreadPool()
@@ -240,7 +240,7 @@ class OptionsDialog(QtW.QDialog):
self.setMinimumSize(300, 200)
self.setWindowIcon(QtG.QIcon(f"{base_path}{os.sep}wrenchIcon.ico"))
self.setWindowIcon(QtG.QIcon(os.path.join(base_path, "wrenchIcon.ico")))
self.setWindowTitle("Options")
layout = QtW.QGridLayout()
@@ -318,7 +318,7 @@ if __name__ == '__main__':
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
try:
config = toml.load(f"{base_path}{os.sep}config.toml")
config = toml.load(os.path.join(os.getcwd(), "config.toml"))
except FileNotFoundError:
config = {}
@@ -327,7 +327,7 @@ if __name__ == '__main__':
config["token"] = get_default(config, "token", os.environ.get("SOLDER_KEY") or "")
config["extract"] = get_default(config, "extract", True)
config["upload"] = get_default(config, "upload", False)
with open(f"{base_path}{os.sep}config.toml", "w") as f:
with open(os.path.join(os.getcwd(), "config.toml"), "w") as f:
toml.dump(config, f)
f.close()