For all downloaded files ensure parent dir exists

This commit is contained in:
David Stainton 2015-10-05 12:59:58 +02:00 committed by Brian Warner
parent c2d672e0b6
commit f8bb229ab7

View File

@ -580,6 +580,11 @@ class Downloader(QueueMixin):
if now is None:
now = time.time()
# ensure parent directory exists
head, tail = os.path.split(abspath_u)
mode = 0777 # XXX
fileutil.make_dirs(head, mode)
fileutil.write(replacement_path_u, file_contents)
os.utime(replacement_path_u, (now, now - cls.FUDGE_SECONDS))
if is_conflict: