chiark / gitweb /
Fix issue related to creating fdroidvcs file
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 15 Jan 2016 12:16:01 +0000 (13:16 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 11 Mar 2016 13:27:01 +0000 (13:27 +0000)
fdroidserver/common.py

index ce5179ce2a6a167cc0999c8bb98ddfd46e51f7f4..6eaab93693461ea70afcea52de995a182a3e90d4 100644 (file)
@@ -531,6 +531,7 @@ class vcs:
         # automatically if either of those things changes.
         fdpath = os.path.join(self.local, '..',
                               '.fdroidvcs-' + os.path.basename(self.local))
+        fdpath = os.path.normpath(fdpath)
         cdata = self.repotype() + ' ' + self.remote
         writeback = True
         deleterepo = False
@@ -562,7 +563,8 @@ class vcs:
 
         # If necessary, write the .fdroidvcs file.
         if writeback and not self.clone_failed:
-            with open(fdpath, 'w') as f:
+            os.makedirs(os.path.dirname(fdpath), exist_ok=True)
+            with open(fdpath, 'w+') as f:
                 f.write(cdata)
 
         if exc is not None: