From 7fd1964c6f87d0ab9c8645244364ebad9d834f89 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Thu, 11 Oct 2007 01:54:23 -0700
Subject: [PATCH] runner: make most commands use ~/.tahoe by default
 (create-client, start/stop/restart, all CLI tools, but *not*
 create-introducer

---
 src/allmydata/scripts/common.py      | 4 ++--
 src/allmydata/scripts/create_node.py | 4 ++--
 src/allmydata/test/test_runner.py    | 5 -----
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/allmydata/scripts/common.py b/src/allmydata/scripts/common.py
index f51e886a..64cceb88 100644
--- a/src/allmydata/scripts/common.py
+++ b/src/allmydata/scripts/common.py
@@ -40,7 +40,7 @@ class BasedirMixin:
             self.basedirs.extend(args)
         else:
             if len(args) == 0 and not self.basedirs:
-                self.basedirs.append(".")
+                self.basedirs.append(os.path.expanduser("~/.tahoe"))
             if len(args) > 0:
                 self.basedirs.append(args[0])
             if len(args) > 1:
@@ -48,7 +48,7 @@ class BasedirMixin:
 
 class NoDefaultBasedirMixin(BasedirMixin):
     def parseArgs(self, *args):
-        # create-client won't default to --basedir=.
+        # create-client won't default to --basedir=~/.tahoe
         self.basedirs = []
         if self['basedir']:
             self.basedirs.append(self['basedir'])
diff --git a/src/allmydata/scripts/create_node.py b/src/allmydata/scripts/create_node.py
index 5eb1b092..76263e20 100644
--- a/src/allmydata/scripts/create_node.py
+++ b/src/allmydata/scripts/create_node.py
@@ -1,9 +1,9 @@
 
 import os, sys
 from twisted.python import usage
-from allmydata.scripts.common import NoDefaultBasedirMixin
+from allmydata.scripts.common import BasedirMixin, NoDefaultBasedirMixin
 
-class CreateClientOptions(NoDefaultBasedirMixin, usage.Options):
+class CreateClientOptions(BasedirMixin, usage.Options):
     optParameters = [
         ["basedir", "C", None, "which directory to create the client in"],
         ]
diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py
index 57a10f81..4faa321f 100644
--- a/src/allmydata/test/test_runner.py
+++ b/src/allmydata/test/test_runner.py
@@ -44,11 +44,6 @@ class CreateNode(unittest.TestCase):
                               ["create-client", "basedir", "extraarg"],
                               run_by_human=False)
 
-        self.failUnlessRaises(usage.UsageError,
-                              runner.runner,
-                              ["create-client"],
-                              run_by_human=False)
-
     def test_introducer(self):
         basedir = self.workdir("test_introducer")
         c1 = os.path.join(basedir, "c1")
-- 
2.45.2