mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
os: create the folder described by XDG_CACHE_HOME
, *if it is non empty, and it does not exist yet*, when calling os.cache_dir()
(#20046)
This commit is contained in:
parent
300158dd08
commit
afaeb74238
1 changed files with 3 additions and 0 deletions
|
@ -733,6 +733,9 @@ pub fn cache_dir() string {
|
|||
// or empty, a default equal to $HOME/.cache should be used.
|
||||
xdg_cache_home := getenv('XDG_CACHE_HOME')
|
||||
if xdg_cache_home != '' {
|
||||
if !is_dir(xdg_cache_home) && !is_link(xdg_cache_home) {
|
||||
mkdir_all(xdg_cache_home, mode: 0o700) or { panic(err) }
|
||||
}
|
||||
return xdg_cache_home
|
||||
}
|
||||
cdir := join_path_single(home_dir(), '.cache')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue