Skip to content

Commit

Permalink
potentially fix issues with paths on some systems
Browse files Browse the repository at this point in the history
  • Loading branch information
DJSchaffner committed Dec 16, 2023
1 parent 4206234 commit 3f3abd1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down

0 comments on commit 3f3abd1

Please sign in to comment.