Page MenuHome

blender_add_xdg_cache_support.patch

blender_add_xdg_cache_support.patch

--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -788,6 +788,10 @@
const char *BLI_getDefaultDocumentFolder(void)
{
#if !defined(WIN32)
+ const char *xdg_documents_dir = getenv("XDG_DOCUMENTS_DIR");
+ if (xdg_documents_dir)
+ return xdg_documents_dir;
+
return getenv("HOME");
#else /* Windows */
@@ -1765,7 +1769,14 @@
}
}
#else
- /* Other OS's - Try TMP and TMPDIR */
+ /* Other OS's - Try XDG_CACHE_HOME, TMP and TMPDIR */
+ if (fullname[0] == '\0') {
+ const char *tmp = getenv("XDG_CACHE_HOME");
+ if (tmp && BLI_is_dir(tmp)) {
+ BLI_strncpy(fullname, tmp, maxlen);
+ }
+ }
+
if (fullname[0] == '\0') {
const char *tmp = getenv("TMP");
if (tmp && BLI_is_dir(tmp)) {
@@ -1782,7 +1793,10 @@
#endif
if (fullname[0] == '\0') {
- BLI_strncpy(fullname, "/tmp/", maxlen);
+ /* use $HOME/.cache/ as fallback */
+ const char *home = getenv("HOME");
+ BLI_strncpy(fullname, home, maxlen);
+ strcat(fullname,"/.cache/");
} else {
/* add a trailing slash if needed */
BLI_add_slash(fullname);

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a8/42/5f8ba973a20aafc9ed044f43d83c

Event Timeline