Fix Windows whereis

This commit is contained in:
Fierelier 2024-06-05 13:14:19 +02:00
parent b3565c1c07
commit 8d598ed971

View File

@ -7,10 +7,15 @@ def readJsonFile(file):
global whereis global whereis
def whereis(cmd): def whereis(cmd):
if lv["osName"] != "windows":
if ( if (
os.path.isfile(cmd) and os.path.isfile(cmd) and
os.access(cmd,os.X_OK) os.access(cmd,os.X_OK)
): return cmd ): return cmd
else:
if (
os.path.isfile(cmd)
): return cmd
paths = os.environ["PATH"].split(os.pathsep) paths = os.environ["PATH"].split(os.pathsep)
if lv["osName"] == "windows": if lv["osName"] == "windows":
@ -21,9 +26,8 @@ def whereis(cmd):
if lv["osName"] == "windows": if lv["osName"] == "windows":
for pathext in pathexts: for pathext in pathexts:
if ( if (
os.path.isfile(ffile + pathext) and os.path.isfile(ffile + pathext)
os.access(ffile,os.X_OK) ): return ffile + pathext
): return ffile
else: else:
if ( if (
os.path.isfile(ffile) and os.path.isfile(ffile) and