summaryrefslogtreecommitdiffstats
path: root/pkg/config/config_linux.go
blob: b406e875ed76f9c499702247275dd6a96963975e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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: "",
		OpenCommand:         `xdg-open {{filename}} >/dev/null`,
		OpenLinkCommand:     `xdg-open {{link}} >/dev/null`,
	}
}