Author: andar

Revision: 5254

Log:
        Fix up error message when not specifying a directory with the --config 
option and add this to 1.1.x

Diff:
Modified: branches/1.1.0_RC/deluge/main.py
===================================================================
--- branches/1.1.0_RC/deluge/main.py    2009-05-10 19:28:23 UTC (rev 5253)
+++ branches/1.1.0_RC/deluge/main.py    2009-05-11 04:10:05 UTC (rev 5254)
@@ -63,7 +63,7 @@
         \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 @@
     # 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 @@
     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())

Modified: trunk/deluge/main.py
===================================================================
--- trunk/deluge/main.py        2009-05-10 19:28:23 UTC (rev 5253)
+++ trunk/deluge/main.py        2009-05-11 04:10:05 UTC (rev 5254)
@@ -66,6 +66,20 @@
     # 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 @@
     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)
 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to