Fix issues with relative paths when scripts are packaged into binaries.
This commit is contained in:
@@ -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
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user