]> 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)
committermeejah <meejah@meejah.ca>
Wed, 20 Jan 2016 08:30:17 +0000 (01:30 -0700)
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 f9e0433bcc0b6990cc656f4328113d34d45628b6..54f37faa2500597b4be38e1668ba77da68a41722 100644 (file)
@@ -181,9 +181,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()
@@ -500,9 +502,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 517085e5966aa0f1d9cf56e44cad20b8f55e4f34..5ba56eebd53b600dc34113159f8dcb206ac7d2bb 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 c2931b0755519e8b166ac33f0540b99710a2ac5d..858a0203f5bc46d2a8283c6a09d21cdf0085d146 100644 (file)
@@ -909,7 +909,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():