From bad30bdd79b3b0eea0c9f57a54890a51efc9ca8d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 13 Feb 2022 11:18:51 +0200 Subject: [PATCH] os: allow using XDG_CACHE_HOME for choosing the folder returned by `os.cache_dir()` on windows too --- vlib/os/os.v | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index c52ffa0c1e..ea8a9d7ddd 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -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) {