From f2e9965c3cd0926e8f2d33a7360a0e6e000f3a3d Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Tue, 8 Jan 2008 10:40:35 -0700 Subject: [PATCH] tahoe-fuse: print out helpful error messages if the caller didn't give the right context --- contrib/tahoe-fuse.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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): -- 2.45.2