From 5f2dce140e2fe49796e269c0e0acbc7b44ec1a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Br=C3=BCckner?= Date: Mon, 26 Jul 2021 23:40:47 +0200 Subject: [PATCH] Windows: fix arm.utils.get_fp() if the project path is a drive root --- blender/arm/utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/blender/arm/utils.py b/blender/arm/utils.py index dc468a8d..7a9f1084 100755 --- a/blender/arm/utils.py +++ b/blender/arm/utils.py @@ -100,7 +100,17 @@ def get_fp(): else: s = bpy.data.filepath.split(os.path.sep) s.pop() - return os.path.sep.join(s) + s = os.path.sep.join(s) + if get_os_is_windows() and len(s) == 2 and s[1] == ':': + # If the project is located at a drive root (C:/ for example), + # then s = "C:". If joined later with another path, no path + # separator is added by default because C:some_path is valid + # Windows path syntax (some_path is then relative to the CWD on the + # C drive). We prevent this by manually adding the path separator + # in these cases. Please refer to the Python doc of os.path.join() + # for more details. + s += os.path.sep + return s def get_fp_build(): return os.path.join(get_fp(), build_dir())