From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Tue, 8 Jan 2008 17:40:35 +0000 (-0700)
Subject: tahoe-fuse: print out helpful error messages if the caller didn't give the right... 
X-Git-Tag: allmydata-tahoe-0.7.0~21
X-Git-Url: https://git.rkrishnan.org/listings/status?a=commitdiff_plain;h=f2e9965c3cd0926e8f2d33a7360a0e6e000f3a3d;p=tahoe-lafs%2Ftahoe-lafs.git

tahoe-fuse: print out helpful error messages if the caller didn't give the right context
---

diff --git a/contrib/tahoe-fuse.py b/contrib/tahoe-fuse.py
index 919ec476..c0004ae6 100644
--- a/contrib/tahoe-fuse.py
+++ b/contrib/tahoe-fuse.py
@@ -27,6 +27,9 @@ MagicDevNumber = 42
 
 
 def main(args = sys.argv[1:]):
+    if not args:
+        sys.stderr.write("%s requires one argument which is the mountpoint." % (sys.argv[0],))
+        sys.exit(-1)
     fs = TahoeFS(os.path.expanduser(TahoeConfigDir))
     fs.main()
 
@@ -101,10 +104,15 @@ class TahoeFS (fuse.Fuse):
         self.url = 'http://localhost:%d' % (port,)
 
     def _init_bookmarks(self):
-        f = open(os.path.join(self.confdir, 'fuse-bookmarks.uri'), 'r')
-        uri = f.read().strip()
-        f.close()
-        
+        rootdirfn = os.path.join(self.confdir, 'private', 'root-dir.cap')
+        try:
+            f = open(rootdirfn, 'r')
+            uri = f.read().strip()
+            f.close()
+        except EnvironmentError, le:
+            sys.stderr("%s requires a directory capability in %s, but when it tried to read it, it got: %s" % (sys.argv[0], rootdirfn, le))
+            raise le
+
         self.bookmarks = TahoeDir(self.url, uri)
 
     def _get_node(self, path):