diff --git a/config.py b/config.py index 99dfb1ed4..b7025c664 100644 --- a/config.py +++ b/config.py @@ -60,7 +60,7 @@ def __createDirs(path): if not os.path.exists(path): os.makedirs(path) -def defPaths(): +def defPaths(savepath): global debug global pyfaPath global savePath @@ -87,8 +87,11 @@ def defPaths(): else: savePath = getattr(configforced, "savePath", None) if savePath is None: - savePath = unicode(os.path.expanduser(os.path.join("~", ".pyfa")), + if savepath is None: # savepath is not overriden + savePath = unicode(os.path.expanduser(os.path.join("~", ".pyfa")), sys.getfilesystemencoding()) + else: + savePath = savepath __createDirs(savePath) diff --git a/pyfa.py b/pyfa.py index bf51de26a..146ea704d 100755 --- a/pyfa.py +++ b/pyfa.py @@ -44,6 +44,7 @@ parser.add_option("-r", "--root", action="store_true", dest="rootsavedata", help parser.add_option("-w", "--wx28", action="store_true", dest="force28", help="Force usage of wxPython 2.8", default=False) parser.add_option("-d", "--debug", action="store_true", dest="debug", help="Set logger to debug level.", default=False) parser.add_option("-t", "--title", action="store", dest="title", help="Set Window Title", default=None) +parser.add_option("-s", "--savepath", action="store", dest="savepath", help="Set the folder for savedata", default=None) (options, args) = parser.parse_args() @@ -106,7 +107,10 @@ if __name__ == "__main__": options.title = "pyfa %s%s - Python Fitting Assistant"%(config.version, "" if config.tag.lower() != 'git' else " (git)") config.debug = options.debug - config.defPaths() + # convert to unicode if it is set + if options.savepath is not None: + options.savepath = unicode(options.savepath) + config.defPaths(options.savepath) # Basic logging initialization import logging