]> 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)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 25 Jan 2016 15:44:20 +0000 (15:44 +0000)
src/allmydata/frontends/magic_folder.py

index b6a9476f3627e8db623086656a8d792b1db3c57a..e32459c105977c784e491f9603d4c4bec8a6865a 100644 (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: