Skip to content

Commit a6b6af4

Browse files
committed
Try another way to get exe path
1 parent ca491d5 commit a6b6af4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main/dod3.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
def getResourcePath(filename):
1313
""" Get absolute path to resource, works for dev and for PyInstaller """
14-
if hasattr(sys, '_MEIPASS'):
15-
return os.path.join(sys._MEIPASS, filename)
14+
if getattr(sys, 'frozen', False):
15+
application_path = os.path.dirname(sys.executable)
16+
elif __file__:
17+
application_path = os.path.dirname(__file__)
1618

17-
rootPath = os.path.dirname(__file__)
19+
rootPath = os.path.dirname(application_path)
1820
return os.path.join(rootPath, filename)
1921

2022
class Game:

0 commit comments

Comments
 (0)