Fix directory creation not working with absolute paths

This commit is contained in:
Ricardo Garcia 2008-07-24 10:07:46 +02:00
parent acd3d84298
commit 3af1e17284
1 changed files with 1 additions and 0 deletions

View File

@ -94,6 +94,7 @@ class FileDownloader(object):
"""Create directory components in filename. Similar to Unix "mkdir -p"."""
components = filename.split(os.sep)
aggregate = [os.sep.join(components[0:x]) for x in xrange(1, len(components))]
aggregate = ['%s%s' % (x, os.sep) for x in aggregate] # Finish names with separator
for dir in aggregate:
if not os.path.exists(dir):
os.mkdir(dir)