Fail hard when sys.executable does not exist.

To help diagnose a problem with sys.executable not having a useful path when the app is in a non-ASCII folder. The user data folder can end up in a completely different location as a different series of folders is created.
This commit is contained in:
David Vierra 2015-05-11 18:15:58 -10:00
parent 30f1ad3e7a
commit 1961997d20

View File

@ -3,11 +3,12 @@ import sys
def getUserFilesDirectory():
exe = sys.executable
assert os.path.exists(exe), "%r does not exist" % exe
if hasattr(sys, 'frozen'):
folder = os.path.dirname(exe)
else:
script = sys.argv[0]
if exe.endswith("python") or exe.endswith("python.exe"):
script = sys.argv[0]
folder = os.path.dirname(os.path.dirname(os.path.dirname(script))) # from src/mcedit, ../../
else:
folder = os.path.dirname(exe)