supybot-wizard: Handle os.makedirs errors on Windows

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2009-05-26 16:27:53 -04:00
parent b170d5f9c3
commit 3c898fa483

View File

@ -140,13 +140,15 @@ def getDirectoryName(default, basedir=os.curdir, prompt=True):
os.makedirs(dir) os.makedirs(dir)
done = True done = True
except OSError, e: except OSError, e:
if e.args[0] != 17: # File exists. # 17 is File exists for Linux (and likely other POSIX systems)
# 183 is the same for Windows
if e.args[0] == 17 or (os.name == 'nt' and e.args[0] == 183):
done = True
else:
output("""Sorry, I couldn't make that directory for some output("""Sorry, I couldn't make that directory for some
reason. The Operating System told me %s. You're going to reason. The Operating System told me %s. You're going to
have to pick someplace else.""" % e) have to pick someplace else.""" % e)
prompt = True prompt = True
else:
done = True
return (dir, os.path.dirname(orig_dir)) return (dir, os.path.dirname(orig_dir))
def main(): def main():