os: allow using XDG_CACHE_HOME for choosing the folder returned by `os.cache_dir()` on windows too

pull/13457/head
Delyan Angelov 2022-02-13 11:18:51 +02:00
parent 5071a54b99
commit bad30bdd79
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 3 additions and 5 deletions

View File

@ -615,11 +615,9 @@ pub fn cache_dir() string {
// $XDG_CACHE_HOME defines the base directory relative to which user specific
// non-essential data files should be stored. If $XDG_CACHE_HOME is either not set
// or empty, a default equal to $HOME/.cache should be used.
$if !windows {
xdg_cache_home := getenv('XDG_CACHE_HOME')
if xdg_cache_home != '' {
return xdg_cache_home
}
xdg_cache_home := getenv('XDG_CACHE_HOME')
if xdg_cache_home != '' {
return xdg_cache_home
}
cdir := join_path_single(home_dir(), '.cache')
if !is_dir(cdir) && !is_link(cdir) {