]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Fix some path Unixisms.
authorDaira Hopwood <daira@jacaranda.org>
Fri, 23 Oct 2015 21:02:09 +0000 (22:02 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 27 Oct 2015 11:41:01 +0000 (11:41 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py
src/allmydata/scripts/create_node.py
src/allmydata/scripts/magic_folder_cli.py
src/allmydata/test/test_cli_magic_folder.py
src/allmydata/test/test_magic_folder.py

index 9225d17b3ce01fb6050545d95d6c957335849171..ea5081191489721760ce0fd4c0df491c13a1d75c 100644 (file)
@@ -182,9 +182,11 @@ class Uploader(QueueMixin):
         # TODO: allow a path rather than a cap URI.
         self._upload_dirnode = self._client.create_node_from_uri(upload_dircap)
         if not IDirectoryNode.providedBy(self._upload_dirnode):
-            raise AssertionError("The URI in 'private/magic_folder_dircap' does not refer to a directory.")
+            raise AssertionError("The URI in '%s' does not refer to a directory."
+                                 % os.path.join('private', 'magic_folder_dircap'))
         if self._upload_dirnode.is_unknown() or self._upload_dirnode.is_readonly():
-            raise AssertionError("The URI in 'private/magic_folder_dircap' is not a writecap to a directory.")
+            raise AssertionError("The URI in '%s' is not a writecap to a directory."
+                                 % os.path.join('private', 'magic_folder_dircap'))
 
         self._inotify = get_inotify_module()
         self._notifier = self._inotify.INotify()
@@ -482,9 +484,11 @@ class Downloader(QueueMixin, WriteFileMixin):
         self._collective_dirnode = self._client.create_node_from_uri(collective_dircap)
 
         if not IDirectoryNode.providedBy(self._collective_dirnode):
-            raise AssertionError("The URI in 'private/collective_dircap' does not refer to a directory.")
+            raise AssertionError("The URI in '%s' does not refer to a directory."
+                                 % os.path.join('private', 'collective_dircap'))
         if self._collective_dirnode.is_unknown() or not self._collective_dirnode.is_readonly():
-            raise AssertionError("The URI in 'private/collective_dircap' is not a readonly cap to a directory.")
+            raise AssertionError("The URI in '%s' is not a readonly cap to a directory."
+                                 % os.path.join('private', 'collective_dircap'))
 
         self._turn_delay = self.REMOTE_SCAN_INTERVAL
         self._download_scan_batch = {} # path -> [(filenode, metadata)]
index 65cbb63ae740d1e8630dffde99ee820e59a08914..f5718ae26e17d23ba577c453d0099c5c74f0e451 100644 (file)
@@ -157,7 +157,7 @@ def create_node(config, out=sys.stdout, err=sys.stderr):
     c.write("# Shall this node automatically upload files created or modified in a local directory?\n")
     c.write("enabled = false\n")
     c.write("# To specify the target of uploads, a mutable directory writecap URI must be placed\n"
-            "# in 'private/drop_upload_dircap'.\n")
+            "# in '%s'.\n" % os.path.join('private', 'magic_folder_dircap'))
     c.write("local.directory = ~/drop_upload\n")
     c.write("\n")
 
index 2c98d3c95977534d93d71c887e0c597dcbd08c32..37aeec76a59446893bb7e327f4b2545729b85819 100644 (file)
@@ -145,12 +145,12 @@ def join(options):
         raise usage.UsageError("Invalid invite code.")
     magic_readonly_cap, dmd_write_cap = fields
 
-    dmd_cap_file = os.path.join(options["node-directory"], "private/magic_folder_dircap")
-    collective_readcap_file = os.path.join(options["node-directory"], "private/collective_dircap")
+    dmd_cap_file = os.path.join(options["node-directory"], u"private", u"magic_folder_dircap")
+    collective_readcap_file = os.path.join(options["node-directory"], u"private", u"collective_dircap")
 
     fileutil.write(dmd_cap_file, dmd_write_cap)
     fileutil.write(collective_readcap_file, magic_readonly_cap)
-    fileutil.write(os.path.join(options["node-directory"], "tahoe.cfg"),
+    fileutil.write(os.path.join(options["node-directory"], u"tahoe.cfg"),
                    "[magic_folder]\nenabled = True\nlocal.directory = %s\n"
                    % (options.local_dir.encode('utf-8'),), mode="ab")
     return 0
index 8c54919aa6035dc48661b925df83ac524d60c9a4..bb2848132884d036349da66e8031a5fedcf5487e 100644 (file)
@@ -57,7 +57,8 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
         """Tests that our collective directory has the readonly cap of
         our upload directory.
         """
-        collective_readonly_cap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), "private/collective_dircap"))
+        collective_readonly_cap = fileutil.read(os.path.join(self.get_clientdir(i=client_num),
+                                                             u"private", u"collective_dircap"))
         d = self.do_cli("ls", "--json", collective_readonly_cap, client_num=client_num)
         def _done((rc, stdout, stderr)):
             self.failUnlessEqual(rc, 0)
@@ -72,8 +73,10 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
         return d
 
     def get_caps_from_files(self, client_num):
-        collective_dircap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), "private/collective_dircap"))
-        upload_dircap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), "private/magic_folder_dircap"))
+        collective_dircap = fileutil.read(os.path.join(self.get_clientdir(i=client_num),
+                                                       u"private", u"collective_dircap"))
+        upload_dircap = fileutil.read(os.path.join(self.get_clientdir(i=client_num),
+                                                   u"private", u"magic_folder_dircap"))
         self.failIf(collective_dircap is None or upload_dircap is None)
         return collective_dircap, upload_dircap
 
index 2d60a93efd97285b8a9a706a537195bd546aa6cb..7cf84bccb6906ffa2b8f637d2c0f715c9526ad2d 100644 (file)
@@ -842,7 +842,7 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase):
             self.shouldFail(AssertionError, 'readonly upload.dircap', 'is not a writecap to a directory',
                             MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb,)
             self.shouldFail(AssertionError, 'collective dircap',
-                            "The URI in 'private/collective_dircap' is not a readonly cap to a directory.",
+                            "The URI in '%s' is not a readonly cap to a directory." % os.path.join('private', 'collective_dircap'),
                             MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb)
 
             def _not_implemented():