From b19798021d8d3cfc0c2f536219a11d81381fb88a Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Tue, 28 Sep 2010 22:07:33 +0200 Subject: [PATCH] CHange stuff around to be a bit more resilient against errors, create non-existent folders, add a staticPath config var --- config.py | 3 ++- gui/bitmapLoader.py | 2 +- run.py | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 8787ac6c9..8ef67eb5c 100644 --- a/config.py +++ b/config.py @@ -6,11 +6,12 @@ debug = False #Path autodetection, only change if it doesn't work if hasattr(sys, "frozen"): - path = os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding( ))) + path = os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding( ))) else: path = os.path.dirname(unicode(__file__, sys.getfilesystemencoding())) homePath = os.path.expanduser(os.path.join("~", ".pyfa")) +staticPath = homePath saveddata = os.path.join(homePath, "saveddata.db") # saveddata db location modifier, shouldn't ever need to touch this diff --git a/gui/bitmapLoader.py b/gui/bitmapLoader.py index b89ab2ad1..0a0d6f9f8 100644 --- a/gui/bitmapLoader.py +++ b/gui/bitmapLoader.py @@ -26,7 +26,7 @@ def getStaticBitmap(name, parent, location): static.SetBitmap(getBitmap(name,location)) return static -locationMap = {"pack": os.path.join(config.homePath, "icons")} +locationMap = {"pack": os.path.join(config.staticPath, "icons")} def getBitmap(name,location): icon = getImage(name, location) diff --git a/run.py b/run.py index 861693751..ca02c8bb3 100644 --- a/run.py +++ b/run.py @@ -21,11 +21,15 @@ import config from gui.mainFrame import MainFrame import wx +import os import os.path import eos.db if __name__ == "__main__": #Make sure the saveddata db exists + if not os.path.exists(config.homePath): + os.mkdir(config.homePath) + if not os.path.exists(config.saveddata): eos.db.saveddata_meta.create_all()