From ff96e8648fb6ff71d5d2e96bd2c6dd1223db1b8e Mon Sep 17 00:00:00 2001 From: Luca Scheller Date: Sat, 28 Oct 2023 00:06:26 +0200 Subject: [PATCH] Fix drive letter bug on Windows for the PythonResolver --- src/PythonResolver/PythonExpose.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PythonResolver/PythonExpose.py b/src/PythonResolver/PythonExpose.py index aecd82a..c5ebab9 100644 --- a/src/PythonResolver/PythonExpose.py +++ b/src/PythonResolver/PythonExpose.py @@ -16,7 +16,7 @@ # Utils SYSTEM_IS_LINUX = sys.platform.lower() == "linux" -SYSTEM_IS_WINDOWS = sys.platform.lower() == "windows" +SYSTEM_IS_WINDOWS = any([w in sys.platform.lower() for w in ["windows", "win32", "win64", "cygwin"]]) def log_function_args(func): """Decorator to print function call details.""" @@ -42,7 +42,8 @@ def TfIsRelativePath(path): bool: State if the path is a relative path """ if SYSTEM_IS_WINDOWS: - return not path or path[0] != '/' and path[0] == '\\' + drive, tail = os.path.splitdrive(path) + return not path or (path[0] != '/' and path[0] != '\\' and not drive) else: return not path or path[0] != '/'