From c29a369289e7d388af9762b7b8973aa53df821f8 Mon Sep 17 00:00:00 2001 From: Alessio Bogon Date: Thu, 18 Dec 2014 03:13:36 +0100 Subject: [PATCH] Fix "modify_autojump_sh" wrong behavior The "modify_autojump_sh" function in "install.py" patches the "autojump.sh" in the wrong way in case the user has chosen a different dest_dir. In particular, if we consider a dest_dir set to "/usr/local/Cellar/autojump/22.2.2", it would write something like: source /usr/local/Cellar/autojump/22.2.2/etc/profile.d/autojump.${shell} which does not exist, since all the autojump.${shell} files are placed under the share_dir. The correct path would be: /usr/local/Cellar/autojump/22.2.2/share/autojump/autojump.${shell} --- install.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.py b/install.py index 09fd557..039c6a2 100755 --- a/install.py +++ b/install.py @@ -29,13 +29,13 @@ def mkdir(path, dryrun=False): os.makedirs(path) -def modify_autojump_sh(etc_dir, dryrun=False): +def modify_autojump_sh(etc_dir, share_dir, dryrun=False): """Append custom installation path to autojump.sh""" custom_install = "\ \n# check custom install \ \nif [ -s %s/autojump.${shell} ]; then \ \n\tsource %s/autojump.${shell} \ - \nfi\n" % (etc_dir, etc_dir) + \nfi\n" % (share_dir, share_dir) with open(os.path.join(etc_dir, 'autojump.sh'), 'a') as f: f.write(custom_install) @@ -207,7 +207,7 @@ def main(args): cp('./bin/_j', zshshare_dir, args.dryrun) if args.custom_install: - modify_autojump_sh(etc_dir, args.dryrun) + modify_autojump_sh(etc_dir, share_dir, args.dryrun) show_post_installation_message(etc_dir, share_dir, bin_dir)