summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/commandeer.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/commands/commandeer.go b/commands/commandeer.go
index 545191cfe..cd2866a27 100644
--- a/commands/commandeer.go
+++ b/commands/commandeer.go
@@ -359,20 +359,11 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
return err
}
- cacheDir := config.GetString("cacheDir")
- if cacheDir != "" {
- if helpers.FilePathSeparator != cacheDir[len(cacheDir)-1:] {
- cacheDir = cacheDir + helpers.FilePathSeparator
- }
- isDir, err := helpers.DirExists(cacheDir, sourceFs)
- checkErr(cfg.Logger, err)
- if !isDir {
- mkdir(cacheDir)
- }
- config.Set("cacheDir", cacheDir)
- } else {
- config.Set("cacheDir", helpers.GetTempDir("hugo_cache", sourceFs))
+ cacheDir, err := helpers.GetCacheDir(sourceFs, config)
+ if err != nil {
+ return err
}
+ config.Set("cacheDir", cacheDir)
cfg.Logger.INFO.Println("Using config file:", config.ConfigFileUsed())