Page Menu
Home
Search
Configure Global Search
Log In
Files
F17258
blender_add_xdg_cache_support.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Cosme Domínguez Díaz (cosme)
Nov 13 2013, 3:25 PM
Size
1 KB
Subscribers
None
blender_add_xdg_cache_support.patch
View Options
--- 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);
+ strncat(fullname,"/.cache/",8);
} else {
/* add a trailing slash if needed */
BLI_add_slash(fullname);
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
98/09/4cc89864ba4e0efc450dd116cc06
Event Timeline
Log In to Comment