From 8d598ed9710fbbdaeb589bed432dde0f64c31092 Mon Sep 17 00:00:00 2001 From: Fierelier Date: Wed, 5 Jun 2024 13:14:19 +0200 Subject: [PATCH] Fix Windows whereis --- oml/modules/generic.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/oml/modules/generic.py b/oml/modules/generic.py index a74323e..0e6f2f4 100644 --- a/oml/modules/generic.py +++ b/oml/modules/generic.py @@ -7,10 +7,15 @@ def readJsonFile(file): global whereis def whereis(cmd): - if ( - os.path.isfile(cmd) and - os.access(cmd,os.X_OK) - ): return cmd + if lv["osName"] != "windows": + if ( + os.path.isfile(cmd) and + os.access(cmd,os.X_OK) + ): return cmd + else: + if ( + os.path.isfile(cmd) + ): return cmd paths = os.environ["PATH"].split(os.pathsep) if lv["osName"] == "windows": @@ -21,9 +26,8 @@ def whereis(cmd): if lv["osName"] == "windows": for pathext in pathexts: if ( - os.path.isfile(ffile + pathext) and - os.access(ffile,os.X_OK) - ): return ffile + os.path.isfile(ffile + pathext) + ): return ffile + pathext else: if ( os.path.isfile(ffile) and