summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-20 09:31:27 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-20 09:31:27 -0300
commitaa490cf0a44012158fec298cda30f0962add0982 (patch)
tree34cffe172f9033ab493bc73d02eea4c4f160f0c6
parent2e26c6c4b1368717681b46e141e2146a17d4e646 (diff)
Prioritize path_extension in which method
-rw-r--r--changes/feature_improve_which2
-rw-r--r--src/leap/common/files.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/changes/feature_improve_which b/changes/feature_improve_which
new file mode 100644
index 0000000..d1d1fb5
--- /dev/null
+++ b/changes/feature_improve_which
@@ -0,0 +1,2 @@
+ o Prioritize the path_extension in the which method so it finds our bundled
+ app before the system one, if any.
diff --git a/src/leap/common/files.py b/src/leap/common/files.py
index 9b80236..e3c8423 100644
--- a/src/leap/common/files.py
+++ b/src/leap/common/files.py
@@ -112,7 +112,7 @@ def which(name, flags=os.X_OK, path_extension="/usr/sbin:/sbin"):
result = []
exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
path = os.environ.get('PATH', None)
- path += ":" + path_extension
+ path = path_extension + os.pathsep + path
if path is None:
return []
parts = path.split(os.pathsep)