Unicode basedir changes for ticket798 branch.

This commit is contained in:
david-sarah 2010-08-01 16:53:10 -07:00
parent 013954c265
commit d3a8ef762f
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import os.path, re, sys, fnmatch
from twisted.python import usage
from allmydata.scripts.common import BaseOptions, get_aliases
from allmydata.util.encodingutil import argv_to_unicode
from allmydata.util.encodingutil import argv_to_unicode, argv_to_abspath, quote_output
NODEURL_RE=re.compile("http(s?)://([^:]*)(:([1-9][0-9]*))?")
@ -22,14 +22,13 @@ class VDriveOptions(BaseOptions, usage.Options):
]
def postOptions(self):
# TODO: allow Unicode node-dir
# compute a node-url from the existing options, put in self['node-url']
if self['node-directory']:
if sys.platform == 'win32' and self['node-directory'] == '~/.tahoe':
from allmydata.windows import registry
self['node-directory'] = registry.get_base_dir_path()
else:
self['node-directory'] = os.path.expanduser(self['node-directory'])
self['node-directory'] = argv_to_abspath(self['node-directory'])
if self['node-url']:
if (not isinstance(self['node-url'], basestring)
or not NODEURL_RE.match(self['node-url'])):

View File

@ -2,8 +2,9 @@
import os, sys, urllib
import codecs
from twisted.python import usage
from allmydata.util.encodingutil import unicode_to_url, quote_output
from allmydata.util.assertutil import precondition
from allmydata.util.encodingutil import unicode_to_url, quote_output, argv_to_abspath
from allmydata.util.fileutil import abspath_expanduser_unicode
class BaseOptions:
# unit tests can override these to point at StringIO instances