From 3f3abd1a1acb0a5cf552b3627aa890f254fe2fae Mon Sep 17 00:00:00 2001 From: DJSchaffner Date: Sat, 16 Dec 2023 15:42:17 +0100 Subject: [PATCH] potentially fix issues with paths on some systems --- src/utils.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/utils.py b/src/utils.py index 86cd8a6..cba3dac 100644 --- a/src/utils.py +++ b/src/utils.py @@ -147,10 +147,9 @@ def base_path(): """ # Get absolute path to resource, works for dev and for PyInstaller if getattr(sys, 'frozen', False): - # PyInstaller creates a temp folder and stores path in _MEIPASS return pathlib.Path(pathlib.sys.executable).parent else: - return pathlib.Path() + return pathlib.Path(os.path.dirname(sys.argv[0])) def resource_path(relative_path: str): @@ -164,10 +163,9 @@ def resource_path(relative_path: str): """ # Get absolute path to resource, works for dev and for PyInstaller if getattr(sys, 'frozen', False): - # PyInstaller creates a temp folder and stores path in _MEIPASS - base_path = pathlib.Path(pathlib.sys._MEIPASS) + base_path = pathlib.Path(pathlib.sys.executable) else: - base_path = pathlib.Path() + base_path = pathlib.Path(os.path.dirname(sys.argv[0])) return base_path / "res" / relative_path