mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-14 20:33:59 +02:00
cache: Set default cache path based on $USER
Change the default cache directory to `$TMPDIR/hugo_cache_$USER`, so that multi-user systems do not have caches that interfere with each other. The other cache-choosing logic (e.g. Netlify exceptions, configuration options) are not affected. Fixes #7391
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
254c2b323c
commit
258884f44f
@@ -409,7 +409,12 @@ func GetCacheDir(fs afero.Fs, cacheDir string) (string, error) {
|
||||
}
|
||||
|
||||
// Fall back to a cache in /tmp.
|
||||
return GetTempDir("hugo_cache", fs), nil
|
||||
userName := os.Getenv("USER")
|
||||
if userName != "" {
|
||||
return GetTempDir("hugo_cache_"+userName, fs), nil
|
||||
} else {
|
||||
return GetTempDir("hugo_cache", fs), nil
|
||||
}
|
||||
}
|
||||
|
||||
func cacheDirDefault(cacheDir string) string {
|
||||
|
Reference in New Issue
Block a user