# HG changeset patch # User Jeff Hammel # Date 1320083337 25200 # Node ID b91750a108b2519751d79bb94bd69b4c6a8384fd # Parent 081614c468b83d6a2bb6fa5b45b2f27128e5026f make which.py work diff -r 081614c468b8 -r b91750a108b2 python/which.py --- a/python/which.py Tue Oct 25 20:00:27 2011 -0700 +++ b/python/which.py Mon Oct 31 10:48:57 2011 -0700 @@ -1,13 +1,17 @@ +#!/usr/bin/env python + +import os +import sys + def findInPath(fileName, path=os.environ['PATH']): """python equivalent of which; should really be in the stdlib""" dirs = path.split(os.pathsep) for dir in dirs: if os.path.isfile(os.path.join(dir, fileName)): return os.path.join(dir, fileName) - if mozinfo.isWin: - if os.path.isfile(os.path.join(dir, fileName + ".exe")): - return os.path.join(dir, fileName + ".exe") + if os.path.isfile(os.path.join(dir, fileName + ".exe")): + return os.path.join(dir, fileName + ".exe") if __name__ == '__main__': for i in sys.argv[1:]: - print findInPath(i) \ No newline at end of file + print findInPath(i)