From d8dba100e041f6e6fc7cdd546ae161d5e52f0582 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 30 Apr 2018 12:06:22 +0300 Subject: Move cache to ~/.cache/gomuks by default. Fixes #39 --- config/config.go | 8 ++++---- gomuks.go | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index e11b17a..b025115 100644 --- a/config/config.go +++ b/config/config.go @@ -38,11 +38,11 @@ type Config struct { } // NewConfig creates a config that loads data from the given directory. -func NewConfig(dir string) *Config { +func NewConfig(configDir, cacheDir string) *Config { return &Config{ - Dir: dir, - HistoryDir: filepath.Join(dir, "history"), - MediaDir: filepath.Join(dir, "media"), + Dir: configDir, + HistoryDir: filepath.Join(cacheDir, "history"), + MediaDir: filepath.Join(cacheDir, "media"), } } diff --git a/gomuks.go b/gomuks.go index 5f5d74b..6582ee3 100644 --- a/gomuks.go +++ b/gomuks.go @@ -41,11 +41,12 @@ type Gomuks struct { // but does not start it. func NewGomuks(uiProvider ifc.UIProvider) *Gomuks { configDir := filepath.Join(os.Getenv("HOME"), ".config/gomuks") + cacheDir := filepath.Join(os.Getenv("HOME"), ".cache/gomuks") gmx := &Gomuks{ stop: make(chan bool, 1), } - gmx.config = config.NewConfig(configDir) + gmx.config = config.NewConfig(configDir, cacheDir) gmx.ui = uiProvider(gmx) gmx.matrix = matrix.NewContainer(gmx) gmx.ui.Init() -- cgit v1.2.3