From 4cfeb18632a45c5c79f18c163e32bc138112f1bb Mon Sep 17 00:00:00 2001 From: Baptiste Ottino Date: Fri, 23 Aug 2024 20:48:28 +0200 Subject: [PATCH] Fix opening files with explorer in WSL The OS command to open file in explorer in WSL doesn't currently work as expected; it always opens the file explorer at the default opening location. This is because the {{filename}} variable returns the path in WSL format, and not in the format expected by Windows. We use wslpath, a utility shipped with WSL, to make the path conversion. --- pkg/config/config_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/config_linux.go b/pkg/config/config_linux.go index 8aaea4576..a4c61df4f 100644 --- a/pkg/config/config_linux.go +++ b/pkg/config/config_linux.go @@ -21,7 +21,7 @@ func isContainer() bool { func GetPlatformDefaultConfig() OSConfig { if isWSL() && !isContainer() { return OSConfig{ - Open: `powershell.exe start explorer.exe {{filename}} >/dev/null`, + Open: `powershell.exe start explorer.exe "$(wslpath -w {{filename}})" >/dev/null`, OpenLink: `powershell.exe start {{link}} >/dev/null`, } }