Add support for xdg specification config file (#32)

This commit is contained in:
Stewart Thomson
2020-05-11 12:14:47 -04:00
committed by GitHub
parent 13b13412aa
commit 0c81489742
4 changed files with 13 additions and 0 deletions

View File

@@ -4,11 +4,18 @@ import (
"os/user"
"path/filepath"
"runtime"
"github.com/adrg/xdg"
)
func GetLocations() (res []string) {
res = append(res, "./cli.json")
xdgPath, err := xdg.ConfigFile(filepath.Join("gotify", "cli.json"))
if err == nil {
res = append(res, xdgPath)
}
if usr, err := user.Current(); err == nil {
res = append(res, filepath.Join(usr.HomeDir, ".gotify", "cli.json"))
}