mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
refactor scripts/common.py: move _default_nodedir out to its own file
This commit is contained in:
parent
b5602463dc
commit
1c34cbd627
@ -5,21 +5,7 @@ from twisted.python import usage
|
||||
from allmydata.util.assertutil import precondition
|
||||
from allmydata.util.encodingutil import unicode_to_url, quote_output, \
|
||||
quote_local_unicode_path, argv_to_abspath
|
||||
from allmydata.util.fileutil import abspath_expanduser_unicode
|
||||
|
||||
|
||||
_default_nodedir = None
|
||||
if sys.platform == 'win32':
|
||||
from allmydata.windows import registry
|
||||
path = registry.get_base_dir_path()
|
||||
if path:
|
||||
precondition(isinstance(path, unicode), path)
|
||||
_default_nodedir = abspath_expanduser_unicode(path)
|
||||
|
||||
if _default_nodedir is None:
|
||||
path = abspath_expanduser_unicode(u"~/.tahoe")
|
||||
precondition(isinstance(path, unicode), path)
|
||||
_default_nodedir = path
|
||||
from allmydata.scripts.default_nodedir import _default_nodedir
|
||||
|
||||
def get_default_nodedir():
|
||||
return _default_nodedir
|
||||
|
17
src/allmydata/scripts/default_nodedir.py
Normal file
17
src/allmydata/scripts/default_nodedir.py
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
import sys
|
||||
from allmydata.util.assertutil import precondition
|
||||
from allmydata.util.fileutil import abspath_expanduser_unicode
|
||||
|
||||
_default_nodedir = None
|
||||
if sys.platform == 'win32':
|
||||
from allmydata.windows import registry
|
||||
path = registry.get_base_dir_path()
|
||||
if path:
|
||||
precondition(isinstance(path, unicode), path)
|
||||
_default_nodedir = abspath_expanduser_unicode(path)
|
||||
|
||||
if _default_nodedir is None:
|
||||
path = abspath_expanduser_unicode(u"~/.tahoe")
|
||||
precondition(isinstance(path, unicode), path)
|
||||
_default_nodedir = path
|
Loading…
Reference in New Issue
Block a user