Skip to content

Commit

Permalink
Also fix path discovery for symlinks.
Browse files Browse the repository at this point in the history
Use realpath instead of abspath so that ghar can find its directory even
if "ghar" is a symlink to the script, as well as the case where it's
invoked with a relative path. Also reformat line in accordance with
PEP8.
  • Loading branch information
tornewuff committed Jun 11, 2013
1 parent 2fabd1f commit 684c97b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/ghar
Expand Up @@ -312,7 +312,8 @@ def _init_repos():

def main(args):
# the ghar executable lives in <repo directory>/bin/ghar
args.ghar_dir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
args.ghar_dir = os.path.dirname(os.path.dirname(
os.path.realpath(sys.argv[0])))
_init_repos()
if len(repos) <= 0:
sys.stderr.write("No repos found in %s\n" % args.ghar_dir)
Expand Down

0 comments on commit 684c97b

Please sign in to comment.