Skip to content

Commit

Permalink
Find path correctly when run from symlink. (by Adam Porter)
Browse files Browse the repository at this point in the history
Fixes lp:907278
  • Loading branch information
kevinmehall committed Jan 1, 2012
1 parent 3731602 commit d749c89
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/pithos
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ DBusGMainLoop(set_as_default=True)

# Check if we are working in the source tree or from the installed
# package and mangle the python path accordingly
if os.path.dirname(sys.argv[0]) != ".":
if sys.argv[0][0] == "/":
fullPath = os.path.dirname(sys.argv[0])
realPath = os.path.realpath(sys.argv[0]) # If this file is run from a symlink, it needs to follow the symlink
if os.path.dirname(realPath) != ".":
if realPath[0] == "/":
fullPath = os.path.dirname(realPath)
else:
fullPath = os.getcwd() + "/" + os.path.dirname(sys.argv[0])
fullPath = os.getcwd() + "/" + os.path.dirname(realPath)
else:
fullPath = os.getcwd()
sys.path.insert(0, os.path.dirname(fullPath))
Expand Down

0 comments on commit d749c89

Please sign in to comment.