mirror of
https://github.com/gotify/cli.git
synced 2024-01-28 15:20:39 +03:00
Add support for xdg specification config file (#32)
This commit is contained in:
@@ -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"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user