mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-15 02:34:07 +00:00
parent
a3d42a277d
commit
16da1ade70
1 changed files with 9 additions and 5 deletions
|
@ -27,6 +27,7 @@ import (
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/common/herrors"
|
"github.com/gohugoio/hugo/common/herrors"
|
||||||
"github.com/gohugoio/hugo/common/text"
|
"github.com/gohugoio/hugo/common/text"
|
||||||
|
"github.com/gohugoio/hugo/htesting"
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/hugofs"
|
"github.com/gohugoio/hugo/hugofs"
|
||||||
|
|
||||||
|
@ -411,6 +412,8 @@ func GetCacheDir(fs afero.Fs, cacheDir string) (string, error) {
|
||||||
|
|
||||||
const hugoCacheBase = "hugo_cache"
|
const hugoCacheBase = "hugo_cache"
|
||||||
|
|
||||||
|
// Avoid filling up the home dir with Hugo cache dirs from development.
|
||||||
|
if !htesting.IsTest {
|
||||||
userCacheDir, err := os.UserCacheDir()
|
userCacheDir, err := os.UserCacheDir()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
cacheDir := filepath.Join(userCacheDir, hugoCacheBase)
|
cacheDir := filepath.Join(userCacheDir, hugoCacheBase)
|
||||||
|
@ -418,6 +421,7 @@ func GetCacheDir(fs afero.Fs, cacheDir string) (string, error) {
|
||||||
return cacheDir, nil
|
return cacheDir, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fall back to a cache in /tmp.
|
// Fall back to a cache in /tmp.
|
||||||
userName := os.Getenv("USER")
|
userName := os.Getenv("USER")
|
||||||
|
|
Loading…
Reference in a new issue