summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-03-28 05:54:33 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-03-28 05:54:33 +0200
commit6d1914c53b38126850954f8a6998f69ae20d81e2 (patch)
tree524a1c9e5f3f46850eb6a23576c95d01932fe78d
parentca4f0a3741d9c86de2012a92c1e39e3a86a449af (diff)
downloadkit-6d1914c53b38126850954f8a6998f69ae20d81e2.zip
test
-rw-r--r--source/kit/file.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/kit/file.c b/source/kit/file.c
index 6edaee9..f767851 100644
--- a/source/kit/file.c
+++ b/source/kit/file.c
@@ -146,18 +146,23 @@ kit_string_t kit_path_cache(kit_allocator_t alloc) {
cache = kit_get_env_("LOCALAPPDATA", alloc);
if (cache.size != 0)
return cache;
+ DA_DESTROY(cache);
#endif
+ cache = kit_get_env_("XDG_CACHE_HOME", alloc);
+ if (cache.size != 0)
+ return cache;
+ DA_DESTROY(cache);
+
+ user = kit_path_user(alloc);
+ cache =
#ifdef __APPLE__
- user = kit_path_user(alloc);
- cache = kit_path_join(WRAP_STR(user),
- SZ("Library" PATH_DELIM "Caches"), alloc);
- DA_DESTROY(user);
+ kit_path_join(WRAP_STR(user), SZ("Library" PATH_DELIM "Caches"),
+ alloc);
#else
- user = kit_path_user(alloc);
- cache = kit_path_join(WRAP_STR(user), SZ(".cache"), alloc);
- DA_DESTROY(user);
+ kit_path_join(WRAP_STR(user), SZ(".cache"), alloc);
#endif
+ DA_DESTROY(user);
return cache;
}