diff options
author | 2013-02-12 17:47:45 +0100 | |
---|---|---|
committer | 2013-02-12 17:47:45 +0100 | |
commit | 0336819d432c9dfdcee2c0cdae8b3aa597b4446b (patch) | |
tree | d6f25c850b0c0562ecb09d8b5ab953a29141a868 /module | |
parent | restored old width (diff) | |
download | pyload-0336819d432c9dfdcee2c0cdae8b3aa597b4446b.tar.xz |
closed #1
Diffstat (limited to 'module')
-rw-r--r-- | module/InitHomeDir.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/module/InitHomeDir.py b/module/InitHomeDir.py index 14207847e..ccf525576 100644 --- a/module/InitHomeDir.py +++ b/module/InitHomeDir.py @@ -25,6 +25,7 @@ import sys from sys import argv, platform import __builtin__ + __builtin__.owd = path.abspath("") #original working directory __builtin__.pypath = path.abspath(path.join(__file__, "..", "..")) @@ -52,17 +53,14 @@ else: __builtin__.homedir = homedir +configdir = None args = " ".join(argv) - # dirty method to set configdir from commandline arguments if "--configdir=" in args: - pos = args.find("--configdir=") - end = args.find("-", pos + 12) + for arg in argv: + if arg.startswith("--configdir="): + configdir = arg.replace('--configdir=', '').strip() - if end == -1: - configdir = args[pos + 12:].strip() - else: - configdir = args[pos + 12:end].strip() elif "nosetests" in args: print "Running in test mode" configdir = join(pypath, "tests", "config") @@ -72,8 +70,10 @@ elif path.exists(path.join(pypath, "module", "config", "configdir")): c = f.read().strip() f.close() configdir = path.join(pypath, c) -else: - if platform in ("posix", "linux2"): + +# default config dir +if not configdir: + if platform in ("posix", "linux2", "darwin"): configdir = path.join(homedir, ".pyload") else: configdir = path.join(homedir, "pyload") |