+5
-2
internal/config/config.go
+5
-2
internal/config/config.go
···
9
9
10
10
"github.com/adrg/xdg"
11
11
"github.com/pelletier/go-toml/v2"
12
+
"olexsmir.xyz/x/envy"
12
13
)
13
14
14
15
//go:embed config.toml
15
16
var defaultConfig []byte
17
+
18
+
var appName = envy.GetOrDefault("APPNAME", "smutok")
16
19
17
20
var (
18
21
ErrUnsetPasswordEnv = errors.New("password env is unset")
···
75
78
func MustGetConfigFilePath() string { return mustGetConfigFile("config.toml") }
76
79
77
80
func mustGetStateFile(file string) string {
78
-
stateFile, err := xdg.StateFile("smutok/" + file)
81
+
stateFile, err := xdg.StateFile(filepath.Join(appName, file))
79
82
if err != nil {
80
83
panic(err)
81
84
}
···
83
86
}
84
87
85
88
func mustGetConfigFile(file string) string {
86
-
configFile, err := xdg.ConfigFile("smutok/" + file)
89
+
configFile, err := xdg.ConfigFile(filepath.Join(appName, file))
87
90
if err != nil {
88
91
panic(err)
89
92
}