From 34bb2c733a6c99dffc682edcc6b6a52bddfdae86 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Fri, 11 Jan 2008 20:52:11 +0000 Subject: [PATCH] Don't check that $PATH is writable unless we're actually trying to add something. This bug could prevent --manpage, etc, from working. --- 0alias | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/0alias b/0alias index a1caf11..2322662 100755 --- a/0alias +++ b/0alias @@ -22,16 +22,13 @@ def find_path(paths): else: break else: - print >>sys.stderr, ("No writable non-cache directory in $PATH, which currently contains:\n\n%s\n\n" - "To create a directory for your scripts, use these commands:\n" - "$ mkdir ~/bin\n" - "$ %s\n" - "or specify a writable path with --path" - % ('\n'.join(os.environ['PATH'].split(':')), export('PATH', '$HOME/bin:$PATH'))) - sys.exit(1) + return None return path +# Do this here so we can include it in the help message. +# But, don't abort if there isn't one because we might +# be doing something else (e.g. --manpage) first_path = find_path(os.environ['PATH'].split(':')) parser = OptionParser(usage="usage: %%prog [options] alias [interface [command]]\n\n" @@ -152,6 +149,15 @@ if options.manpage: print os.path.join(root, file) sys.exit(1) +if first_path is None: + print >>sys.stderr, ("No writable non-cache directory in $PATH, which currently contains:\n\n%s\n\n" + "To create a directory for your scripts, use these commands:\n" + "$ mkdir ~/bin\n" + "$ %s\n" + "or specify a writable path with --path" + % ('\n'.join(os.environ['PATH'].split(':')), export('PATH', '$HOME/bin:$PATH'))) + sys.exit(1) + if len(args) == 1: os.execlp('0launch', '0launch', '-gd', '--', interface_uri) sys.exit(1) -- 2.11.4.GIT