From 17210d1acae49e4d42d233ee75668f022cdcf2c3 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 18 May 2025 16:30:43 +0200 Subject: [PATCH] port VSC: take care of WSL use (#23440) --- pio-tools/port-vsc.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pio-tools/port-vsc.py b/pio-tools/port-vsc.py index 0ffdb8751..f8b548588 100644 --- a/pio-tools/port-vsc.py +++ b/pio-tools/port-vsc.py @@ -23,6 +23,15 @@ if os.environ.get("PLATFORMIO_CALLER") == "vscode": except KeyError: print("Unknown OS: " + os_name) + # If the database is not found, check if running in WSL + # and try to find the database in the Windows file system + if not os.path.exists(db_path) and os_name == "Linux": + try: + db_path = os.path.expanduser(os.path.expandvars(os_paths["Windows"])) + print("Windows running PIO in WSL") + except KeyError: + pass + # Only when the database is found we can go on if os.path.exists(db_path): conn = sqlite3.connect(db_path)