Skip to content

Commit

Permalink
Fix opening files with explorer in WSL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bottino authored and stefanhaller committed Dec 4, 2024
1 parent 3a4422f commit 4cfeb18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/config/config_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
}
}
Expand Down

0 comments on commit 4cfeb18

Please sign in to comment.