From fc8ab5b2168ead7b0b7fd376bbe91d53e21fdc7b Mon Sep 17 00:00:00 2001 From: Marek Kubica Date: Tue, 15 Nov 2011 17:32:41 +0900 Subject: [PATCH] Changed from sys.argv to __file__ With sys.path the package depends on the fact that the mangle.pyw launcher is exactly one directory under the package. __file__ on the other hand, is relative to the package, so it does not matter where the mangle.pyw file is or whether it even exists at all, thus making the package self-contained. This is useful when putting the package in site-packages and the launcher into $PATH. --- mangle/util.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mangle/util.py b/mangle/util.py index b4eb6ba..6e39dc6 100644 --- a/mangle/util.py +++ b/mangle/util.py @@ -14,10 +14,9 @@ # along with this program. If not, see . -import sys import os.path def buildResPath(relative): - directory = os.path.split(sys.argv[0])[0] + directory = os.path.dirname(__file__) return os.path.join(directory, relative)