diff options
author | Andrew Resch <andrewresch@gmail.com> | 2009-05-11 04:10:05 +0000 |
---|---|---|
committer | Andrew Resch <andrewresch@gmail.com> | 2009-05-11 04:10:05 +0000 |
commit | 1f06be95d18c1e04046eada6368ef22081b117ab (patch) | |
tree | 2262993622a1227f6896b580ceae0694e0d593fb | |
parent | d85d8945e75145e2764cc38f97b008fa3fbe46f7 (diff) | |
download | deluge-1f06be95d18c1e04046eada6368ef22081b117ab.tar.gz deluge-1f06be95d18c1e04046eada6368ef22081b117ab.tar.bz2 deluge-1f06be95d18c1e04046eada6368ef22081b117ab.zip |
Fix up error message when not specifying a directory with the --config option and add this to 1.1.x
-rw-r--r-- | deluge/main.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/deluge/main.py b/deluge/main.py index 2308f9f71..57e7c0615 100644 --- a/deluge/main.py +++ b/deluge/main.py @@ -63,7 +63,7 @@ def start_ui(): \t web -- A web-based interface (http://localhost:8112)\n \t console -- A console or command-line interface""", action="store", type="str") parser.add_option("-c", "--config", dest="config", - help="Set the config location", action="store", type="str") + help="Set the config folder location", action="store", type="str") parser.add_option("-l", "--logfile", dest="logfile", help="Output to designated logfile instead of stdout", action="store", type="str") parser.add_option("-a", "--args", dest="args", @@ -78,6 +78,17 @@ def start_ui(): # Get the options and args from the OptionParser (options, args) = parser.parse_args() + if options.config: + if not os.path.exists(options.config): + # Try to create the config folder if it doesn't exist + try: + os.makedirs(options.config) + except Exception, e: + pass + elif not os.path.isdir(options.config): + print "Config option needs to be a directory!" + sys.exit(1) + if options.default_ui: if options.config: deluge.configmanager.set_config_dir(options.config) @@ -91,13 +102,6 @@ def start_ui(): if options.quiet: options.loglevel = "none" - if options.config: - if not os.path.exists(options.config): - # Try to create the config folder if it doesn't exist - try: - os.makedirs(options.config) - except Exception, e: - pass else: if not os.path.exists(deluge.common.get_default_config_dir()): os.makedirs(deluge.common.get_default_config_dir()) |