We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6af498b commit cfe5d47Copy full SHA for cfe5d47
1 file changed
utils/files.py
@@ -1,15 +1,11 @@
1
import os
2
import sys
3
4
-from . import config
5
-
6
def resource_path(relative_path):
7
- if config.PRODUCTION:
8
- try:
9
- base_path = sys._MEIPASS
10
- except Exception:
11
- base_path = os.path.abspath(".")
12
13
- return os.path.join(base_path, relative_path)
+ """ Get the absolute path to a resource, handling PyInstaller builds. """
+ if getattr(sys, 'frozen', False): # Detect if running as a PyInstaller bundle
+ base_path = sys._MEIPASS # Extracted temp folder
14
else:
15
- return relative_path
+ base_path = os.path.abspath(".") # Normal script execution
+
+ return os.path.join(base_path, relative_path)
0 commit comments