aboutsummaryrefslogtreecommitdiffstats
path: root/worker/jmap
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-08-23 21:36:23 +0200
committerRobin Jarry <robin@jarry.cc>2023-08-27 18:44:12 +0200
commita5bc7ccf0cae608ac1e72ab4c9ebe5596eb8c988 (patch)
treebe2e5f55fc21980489dca61947ea6b9819853ec3 /worker/jmap
parentfff16640ad7cd8c4b73187fbce10f2aa558701be (diff)
downloadaerc-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 'worker/jmap')
-rw-r--r--worker/jmap/cache/cache.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/worker/jmap/cache/cache.go b/worker/jmap/cache/cache.go
index 07d23493..249ed0e9 100644
--- a/worker/jmap/cache/cache.go
+++ b/worker/jmap/cache/cache.go
@@ -5,8 +5,8 @@ import (
"os"
"path"
+ "git.sr.ht/~rjarry/aerc/lib/xdg"
"git.sr.ht/~rjarry/aerc/log"
- "github.com/mitchellh/go-homedir"
"github.com/syndtr/goleveldb/leveldb"
)
@@ -18,15 +18,9 @@ type JMAPCache struct {
func NewJMAPCache(state, blobs bool, accountName string) *JMAPCache {
c := new(JMAPCache)
- cacheDir, err := os.UserCacheDir()
- if err != nil {
- cacheDir, err = homedir.Expand("~/.cache")
- if err != nil {
- log.Errorf("homedir.Expand: %s", err)
- cacheDir = ""
- }
- }
+ cacheDir := xdg.CachePath()
if state && cacheDir != "" {
+ var err error
dir := path.Join(cacheDir, "aerc", accountName, "state")
_ = os.MkdirAll(dir, 0o700)
c.file, err = leveldb.OpenFile(dir, nil)