Make sure searchPath is always a string

This commit is contained in:
Ian Paschal 2018-07-09 15:54:54 +02:00
parent 8dab2a6696
commit 5e30fdf0fe

View file

@ -5,6 +5,8 @@ import subprocess
# A quick Python implementation of unix 'where' command. # A quick Python implementation of unix 'where' command.
def where(exeName, searchPath=os.getenv("PATH")): def where(exeName, searchPath=os.getenv("PATH")):
if searchPath is None:
searchPath = ""
paths = searchPath.split(";" if sys.platform == "win32" else ":") paths = searchPath.split(";" if sys.platform == "win32" else ":")
for path in paths: for path in paths:
candidatePath = os.path.join(path, exeName) candidatePath = os.path.join(path, exeName)