diff options
author | Robin Jarry <robin@jarry.cc> | 2023-08-23 21:36:23 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-08-27 18:44:12 +0200 |
commit | a5bc7ccf0cae608ac1e72ab4c9ebe5596eb8c988 (patch) | |
tree | be2e5f55fc21980489dca61947ea6b9819853ec3 /config/config.go | |
parent | fff16640ad7cd8c4b73187fbce10f2aa558701be (diff) | |
download | aerc-a5bc7ccf0cae608ac1e72ab4c9ebe5596eb8c988.tar.gz |
xdg: get rid of deprecated dependencies
github.com/mitchellh/go-homedir has not received any update since 2019.
The last release of github.com/kyoh86/xdg was in 2020 and it has been
marked as deprecated by its author.
Replace these with internal functions.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'config/config.go')
-rw-r--r-- | config/config.go | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/config/config.go b/config/config.go index 4ace7d26..092b73a6 100644 --- a/config/config.go +++ b/config/config.go @@ -3,14 +3,12 @@ package config import ( "errors" "fmt" - "log" "os" "path" "strings" + "git.sr.ht/~rjarry/aerc/lib/xdg" "github.com/go-ini/ini" - "github.com/kyoh86/xdg" - "github.com/mitchellh/go-homedir" ) // Set at build time @@ -23,34 +21,24 @@ func buildDefaultDirs() []string { var defaultDirs []string prefixes := []string{ - xdg.ConfigHome(), + xdg.ConfigPath(), "~/.local/libexec", - xdg.DataHome(), + xdg.DataPath(), } // Add XDG_CONFIG_HOME and XDG_DATA_HOME for _, v := range prefixes { if v != "" { - v, err := homedir.Expand(v) - if err != nil { - log.Println(err) - } - defaultDirs = append(defaultDirs, path.Join(v, "aerc")) + defaultDirs = append(defaultDirs, xdg.ExpandHome(v, "aerc")) } } // Add custom buildtime dirs if libexecDir != "" && libexecDir != "/usr/local/libexec/aerc" { - libexecDir, err := homedir.Expand(libexecDir) - if err == nil { - defaultDirs = append(defaultDirs, libexecDir) - } + defaultDirs = append(defaultDirs, xdg.ExpandHome(libexecDir)) } if shareDir != "" && shareDir != "/usr/local/share/aerc" { - shareDir, err := homedir.Expand(shareDir) - if err == nil { - defaultDirs = append(defaultDirs, shareDir) - } + defaultDirs = append(defaultDirs, xdg.ExpandHome(shareDir)) } // Add fixed fallback locations @@ -91,7 +79,7 @@ func installTemplate(root, name string) error { func LoadConfigFromFile(root *string, accts []string) error { if root == nil { - _root := path.Join(xdg.ConfigHome(), "aerc") + _root := xdg.ConfigPath("aerc") root = &_root } filename := path.Join(*root, "aerc.conf") |