From b8f6c4aa8d3fe18e29eb5326afbea9f36b8ec7f7 Mon Sep 17 00:00:00 2001 From: davtur19 Date: Sat, 28 Dec 2024 21:56:32 +0100 Subject: [PATCH] replace /mnt/c/ to C:/ for WSL and detecting letter drive --- litex/build/gowin/gowin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/litex/build/gowin/gowin.py b/litex/build/gowin/gowin.py index 51d423fe0..6a14c6040 100644 --- a/litex/build/gowin/gowin.py +++ b/litex/build/gowin/gowin.py @@ -149,6 +149,10 @@ class GowinToolchain(GenericToolchain): # Support windows/powershell if sys.platform == "win32": 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}") # Set Options.