Skip to content

Commit

Permalink
support open file and link on WSL
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhs0506 committed Jun 12, 2022
1 parent 2bccbee commit 3067c2c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/config/config_linux.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
package config

import (
"io/ioutil"
"strings"
)

func isWSL() bool {
data, err := ioutil.ReadFile("/proc/sys/kernel/osrelease");
return err == nil && strings.Contains(string(data), "microsoft")
}

// GetPlatformDefaultConfig gets the defaults for the platform
func GetPlatformDefaultConfig() OSConfig {

if isWSL() {
return OSConfig{
EditCommand: ``,
EditCommandTemplate: "",
OpenCommand: `powershell.exe start explorer.exe {{filename}} >/dev/null`,
OpenLinkCommand: `powershell.exe start {{link}} >/dev/null`,
}
}

return OSConfig{
EditCommand: ``,
EditCommandTemplate: "",
Expand Down

0 comments on commit 3067c2c

Please sign in to comment.