mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-26 06:09:21 +00:00
Fix some path Unixisms.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
cda88b2f80
commit
035a7c9d31
@ -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)]
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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():
|
||||
|
Loading…
x
Reference in New Issue
Block a user