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.
This commit is contained in:
Baptiste Ottino 2024-08-23 20:48:28 +02:00 committed by Stefan Haller
parent 3a4422fc68
commit 4cfeb18632

View file

@ -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`,
}
}