From 7aea3a290e79c0f2dae30c8fdf1f8e43d56438a5 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 11 May 2009 04:10:05 +0000 Subject: [PATCH] Fix up error message when not specifying a directory with the --config option and add this to 1.1.x --- deluge/main.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/deluge/main.py b/deluge/main.py index 214676ad5..dbf69a7a2 100644 --- a/deluge/main.py +++ b/deluge/main.py @@ -66,6 +66,20 @@ 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) + else: + if not os.path.exists(deluge.common.get_default_config_dir()): + os.makedirs(deluge.common.get_default_config_dir()) + if options.default_ui: if options.config: deluge.configmanager.set_config_dir(options.config) @@ -79,21 +93,6 @@ def start_ui(): if options.quiet: options.loglevel = "none" - if options.config: - if not os.path.isdir(options.config): - print "Config option needs to be a directory!" - sys.exit(1) - - 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()) - # Setup the logger deluge.log.setupLogger(level=options.loglevel, filename=options.logfile)