From: robk-tahoe <robk-tahoe@allmydata.com>
Date: Fri, 11 Jan 2008 02:32:18 +0000 (-0700)
Subject: change default node-directory on windows to do registry lookup, not ~/.tahoe
X-Git-Url: https://git.rkrishnan.org/components/banana.xhtml?a=commitdiff_plain;h=0b097ac485f5eec98767bb6f7de65df35f3d66d5;p=tahoe-lafs%2Ftahoe-lafs.git

change default node-directory on windows to do registry lookup, not ~/.tahoe
---

diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py
index c8d01eff..c03b88cd 100644
--- a/src/allmydata/scripts/cli.py
+++ b/src/allmydata/scripts/cli.py
@@ -27,7 +27,11 @@ class VDriveOptions(BaseOptions, usage.Options):
     def postOptions(self):
         # compute a node-url from the existing options, put in self['node-url']
         if self['node-directory']:
-            self['node-directory'] = os.path.expanduser(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'])
         if self['node-url']:
             if (not isinstance(self['node-url'], basestring)
                 or not NODEURL_RE.match(self['node-url'])):
diff --git a/src/allmydata/scripts/common.py b/src/allmydata/scripts/common.py
index dd15fda8..6391a91b 100644
--- a/src/allmydata/scripts/common.py
+++ b/src/allmydata/scripts/common.py
@@ -36,7 +36,11 @@ class BasedirMixin:
             self.basedirs.extend(args)
         else:
             if len(args) == 0 and not self.basedirs:
-                self.basedirs.append(os.path.expanduser("~/.tahoe"))
+                if sys.platform == 'win32':
+                    from allmydata.windows import registry
+                    self.basedirs.append(registry.get_base_dir_path())
+                else:
+                    self.basedirs.append(os.path.expanduser("~/.tahoe"))
             if len(args) > 0:
                 self.basedirs.append(args[0])
             if len(args) > 1: