]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
For all downloaded files ensure parent dir exists
authorDavid Stainton <dstainton415@gmail.com>
Mon, 5 Oct 2015 10:59:58 +0000 (12:59 +0200)
committerDavid Stainton <dstainton415@gmail.com>
Mon, 5 Oct 2015 10:59:58 +0000 (12:59 +0200)
src/allmydata/frontends/magic_folder.py

index 422a7c113a436abca280e1a87b606f24f23fd8f7..e0327a18e7ee6ce55ab7390a8e351dfb85c74f88 100644 (file)
@@ -578,6 +578,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: