replace /mnt/c/ to C:/ for WSL and detecting letter drive

This commit is contained in:
davtur19 2024-12-28 21:56:32 +01:00 committed by GitHub
parent 05d7471f6c
commit b8f6c4aa8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -149,6 +149,10 @@ class GowinToolchain(GenericToolchain):
# Support windows/powershell # Support windows/powershell
if sys.platform == "win32": if sys.platform == "win32":
f = f.replace("\\", "\\\\") f = f.replace("\\", "\\\\")
# replace /mnt/c/ to C:/ for WSL and detecting letter drive
elif "linux" in sys.platform and "WSL" in os.uname().release and f.startswith("/mnt/") and len(f) > 6:
f = f"{f[5].upper()}:\\\\" + f[7:]
f = f.replace("/", "\\\\")
tcl.append(f"add_file {f}") tcl.append(f"add_file {f}")
# Set Options. # Set Options.