hugo/helpers
Bjørn Erik Pedersen b3f10556f0
Use os.UserCacheDir as first fallback if cacheDir is not set
We will now try

1. cacheDir (or, commonly set in environment as `HUGO_CACHEDIR`)
2. if on Netlify we use `/opt/build/cache/hugo_cache/`
3. os.UserCacheDir
4. A temp dir

Storing the cache, especially the module cache, in a temporary idea has had lots of hard to debug issues, especially on MacOS,
which this commit tries to fix.

This should also make it easier to locate the Hugo cache:

>UserCacheDir returns the default root directory to use for user-specific cached data. Users should create their own
application-specific subdirectory within this one and use that.
>
>On Unix systems, it returns $XDG_CACHE_HOME as specified by
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.cache. On Darwin, it
returns $HOME/Library/Caches. On Windows, it returns %LocalAppData%. On Plan 9, it returns $home/lib/cache.
>
>If the location cannot be determined (for example, $HOME is not defined), then it will return an error.

Fixes #11286
Fixes #11291
2023-07-27 20:59:47 +02:00
..
content.go
content_test.go
docshelper.go
emoji.go all: Fix typos in function names and comments 2023-06-19 09:26:29 +02:00
emoji_test.go all: Fix typos in function names and comments 2023-06-19 09:26:29 +02:00
general.go Add titleCaseStyle none and firstupper 2023-07-05 20:35:20 +02:00
general_test.go Add titleCaseStyle none and firstupper 2023-07-05 20:35:20 +02:00
path.go Use os.UserCacheDir as first fallback if cacheDir is not set 2023-07-27 20:59:47 +02:00
path_test.go
pathspec.go
processing_stats.go
testhelpers_test.go Replace the old log setup, with structured logging etc. 2023-06-18 13:03:04 +02:00
url.go helpers: Avoid url.Parse in RelURL and AbsURL if we can 2023-06-12 16:15:59 +02:00
url_test.go Fix defaultContentLanguageInSubdir with only 1 language 2023-07-08 16:08:46 +02:00