[RARSLAVE] Fix working directory option
authorIra W. Snyder <devel@irasnyder.com>
Wed, 27 Dec 2006 04:00:52 +0000 (20:00 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Wed, 27 Dec 2006 04:00:52 +0000 (20:00 -0800)
Add a check to make sure the working directory is valid before trying
anything, that way we don't fail later.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
rarslave.py

index 1315f85..ceb7eac 100644 (file)
@@ -479,8 +479,17 @@ def check_required_progs():
                sys.exit(1)
 
 def run_options (options):
+
+       # Fix directories
        options.work_dir = full_abspath (options.work_dir)
 
+       # Make sure that the directory is valid
+       if not os.path.isdir (options.work_dir):
+               sys.stderr.write ('\"%s\" is not a valid directory. Use the \"-d\"\n' % options.work_dir)
+               sys.stderr.write ('option to override the working directory temporarily, or edit the\n')
+               sys.stderr.write ('configuration file to override the working directory permanently.\n')
+               sys.exit (1)
+
        if options.extract_dir != None:
                options.extract_dir = full_abspath (options.extract_dir)