Merge pull request #2286 from MoritzBrueckner/fix-getfp-drive-root

Windows: fix arm.utils.get_fp() if the project path is a drive root
This commit is contained in:
Lubos Lenco 2021-08-01 16:50:22 +02:00 committed by GitHub
commit 60d0f443f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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())