mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 11:16:24 +00:00
More path fixes.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
f12ac3d94e
commit
dacf6ef633
@ -27,10 +27,13 @@ class CreateOptions(BasedirOptions):
|
|||||||
raise usage.UsageError("An alias must end with a ':' character.")
|
raise usage.UsageError("An alias must end with a ':' character.")
|
||||||
self.alias = alias[:-1]
|
self.alias = alias[:-1]
|
||||||
self.nickname = None if nickname is None else argv_to_unicode(nickname)
|
self.nickname = None if nickname is None else argv_to_unicode(nickname)
|
||||||
self.local_dir = None if local_dir is None else argv_to_abspath(local_dir)
|
|
||||||
|
# Expand the path relative to the current directory of the CLI command, not the node.
|
||||||
|
self.local_dir = None if local_dir is None else argv_to_abspath(local_dir, long_path=False)
|
||||||
|
|
||||||
if self.nickname and not self.local_dir:
|
if self.nickname and not self.local_dir:
|
||||||
raise usage.UsageError("If NICKNAME is specified then LOCAL_DIR must also be specified.")
|
raise usage.UsageError("If NICKNAME is specified then LOCAL_DIR must also be specified.")
|
||||||
node_url_file = os.path.join(self['node-directory'], "node.url")
|
node_url_file = os.path.join(self['node-directory'], u"node.url")
|
||||||
self['node-url'] = fileutil.read(node_url_file).strip()
|
self['node-url'] = fileutil.read(node_url_file).strip()
|
||||||
|
|
||||||
def _delegate_options(source_options, target_options):
|
def _delegate_options(source_options, target_options):
|
||||||
@ -88,7 +91,7 @@ class InviteOptions(BasedirOptions):
|
|||||||
raise usage.UsageError("An alias must end with a ':' character.")
|
raise usage.UsageError("An alias must end with a ':' character.")
|
||||||
self.alias = alias[:-1]
|
self.alias = alias[:-1]
|
||||||
self.nickname = argv_to_unicode(nickname)
|
self.nickname = argv_to_unicode(nickname)
|
||||||
node_url_file = os.path.join(self['node-directory'], "node.url")
|
node_url_file = os.path.join(self['node-directory'], u"node.url")
|
||||||
self['node-url'] = open(node_url_file, "r").read().strip()
|
self['node-url'] = open(node_url_file, "r").read().strip()
|
||||||
aliases = get_aliases(self['node-directory'])
|
aliases = get_aliases(self['node-directory'])
|
||||||
self.aliases = aliases
|
self.aliases = aliases
|
||||||
|
@ -8,7 +8,6 @@ from twisted.python import usage
|
|||||||
|
|
||||||
from allmydata.util.assertutil import precondition
|
from allmydata.util.assertutil import precondition
|
||||||
from allmydata.util import fileutil
|
from allmydata.util import fileutil
|
||||||
from allmydata.util.fileutil import precondition_abspath
|
|
||||||
from allmydata.scripts.common import get_aliases
|
from allmydata.scripts.common import get_aliases
|
||||||
from allmydata.test.no_network import GridTestMixin
|
from allmydata.test.no_network import GridTestMixin
|
||||||
from .test_cli import CLITestMixin
|
from .test_cli import CLITestMixin
|
||||||
@ -81,11 +80,10 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin):
|
|||||||
return collective_dircap, upload_dircap
|
return collective_dircap, upload_dircap
|
||||||
|
|
||||||
def check_config(self, client_num, local_dir):
|
def check_config(self, client_num, local_dir):
|
||||||
precondition_abspath(local_dir)
|
|
||||||
client_config = fileutil.read(os.path.join(self.get_clientdir(i=client_num), "tahoe.cfg"))
|
client_config = fileutil.read(os.path.join(self.get_clientdir(i=client_num), "tahoe.cfg"))
|
||||||
local_dir_utf8 = local_dir.encode('utf-8')
|
local_dir_utf8 = local_dir.encode('utf-8')
|
||||||
ret = re.search("\[magic_folder\]\nenabled = True\nlocal.directory = %s" % (local_dir_utf8,), client_config)
|
magic_folder_config = "[magic_folder]\nenabled = True\nlocal.directory = %s" % (local_dir_utf8,)
|
||||||
self.failIf(ret is None)
|
self.failUnlessIn(magic_folder_config, client_config)
|
||||||
|
|
||||||
def create_invite_join_magic_folder(self, nickname, local_dir):
|
def create_invite_join_magic_folder(self, nickname, local_dir):
|
||||||
nickname_arg = unicode_to_argv(nickname)
|
nickname_arg = unicode_to_argv(nickname)
|
||||||
|
Loading…
Reference in New Issue
Block a user