Change the way we detect root
This is needed for executable freeze to work correctly
This commit is contained in:
15
config.py
15
config.py
@@ -34,6 +34,18 @@ gameDB = None
|
|||||||
import logging
|
import logging
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
|
|
||||||
|
|
||||||
|
def getPyfaRoot():
|
||||||
|
if hasattr(sys, 'frozen'):
|
||||||
|
base = sys.executable
|
||||||
|
else:
|
||||||
|
base = sys.argv[0]
|
||||||
|
root = os.path.dirname(os.path.realpath(os.path.abspath(base)))
|
||||||
|
root = unicode(root, sys.getfilesystemencoding())
|
||||||
|
print(root)
|
||||||
|
return root
|
||||||
|
|
||||||
|
|
||||||
def defPaths():
|
def defPaths():
|
||||||
global pyfaPath
|
global pyfaPath
|
||||||
global savePath
|
global savePath
|
||||||
@@ -45,8 +57,7 @@ def defPaths():
|
|||||||
# Python 2.X uses ANSI by default, so we need to convert the character encoding
|
# Python 2.X uses ANSI by default, so we need to convert the character encoding
|
||||||
pyfaPath = getattr(configforced, "pyfaPath", pyfaPath)
|
pyfaPath = getattr(configforced, "pyfaPath", pyfaPath)
|
||||||
if pyfaPath is None:
|
if pyfaPath is None:
|
||||||
pyfaPath = unicode(os.path.dirname(os.path.realpath(os.path.abspath(
|
pyfaPath = getPyfaRoot()
|
||||||
sys.modules['__main__'].__file__))), sys.getfilesystemencoding())
|
|
||||||
|
|
||||||
# Where we store the saved fits etc, default is the current users home directory
|
# Where we store the saved fits etc, default is the current users home directory
|
||||||
if saveInRoot is True:
|
if saveInRoot is True:
|
||||||
|
|||||||
Reference in New Issue
Block a user