mirror of
https://github.com/cheat/cheat.git
synced 2024-10-31 21:21:02 +01:00
add FreeBSD to the supported systems in config.Path (#528)
This commit is contained in:
parent
ff6a866abe
commit
4cb7a3b42c
@ -23,36 +23,21 @@ func Path(sys string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return expanded, nil
|
return expanded, nil
|
||||||
|
}
|
||||||
|
|
||||||
// OSX config paths
|
switch sys {
|
||||||
} else if sys == "darwin" {
|
case "darwin", "linux", "freebsd":
|
||||||
|
|
||||||
paths = []string{
|
paths = []string{
|
||||||
path.Join(os.Getenv("XDG_CONFIG_HOME"), "/cheat/conf.yml"),
|
path.Join(os.Getenv("XDG_CONFIG_HOME"), "/cheat/conf.yml"),
|
||||||
path.Join(os.Getenv("HOME"), ".config/cheat/conf.yml"),
|
path.Join(os.Getenv("HOME"), ".config/cheat/conf.yml"),
|
||||||
path.Join(os.Getenv("HOME"), ".cheat/conf.yml"),
|
path.Join(os.Getenv("HOME"), ".cheat/conf.yml"),
|
||||||
}
|
}
|
||||||
|
case "windows":
|
||||||
// Linux config paths
|
|
||||||
} else if sys == "linux" {
|
|
||||||
|
|
||||||
paths = []string{
|
|
||||||
path.Join(os.Getenv("XDG_CONFIG_HOME"), "/cheat/conf.yml"),
|
|
||||||
path.Join(os.Getenv("HOME"), ".config/cheat/conf.yml"),
|
|
||||||
path.Join(os.Getenv("HOME"), ".cheat/conf.yml"),
|
|
||||||
"/etc/cheat/conf.yml",
|
|
||||||
}
|
|
||||||
|
|
||||||
// Windows config paths
|
|
||||||
} else if sys == "windows" {
|
|
||||||
|
|
||||||
paths = []string{
|
paths = []string{
|
||||||
fmt.Sprintf("%s/cheat/conf.yml", os.Getenv("APPDATA")),
|
fmt.Sprintf("%s/cheat/conf.yml", os.Getenv("APPDATA")),
|
||||||
fmt.Sprintf("%s/cheat/conf.yml", os.Getenv("PROGRAMDATA")),
|
fmt.Sprintf("%s/cheat/conf.yml", os.Getenv("PROGRAMDATA")),
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
// Unsupported platforms
|
|
||||||
} else {
|
|
||||||
return "", fmt.Errorf("unsupported os: %s", sys)
|
return "", fmt.Errorf("unsupported os: %s", sys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user