Allow "xdg" to be entered to force XDG cache directory even if

XDG_CACHE_DIR is not set
This commit is contained in:
speedie 2023-06-12 23:44:59 +02:00
parent 1c6bc9f92d
commit b261d62cc9

View file

@ -247,7 +247,7 @@ void loadimagecache(const char *file, int *width, int *height) {
// path for cached thumbnail // path for cached thumbnail
if (!cachedir || !strcmp(cachedir, "default")) { if (!cachedir || !strcmp(cachedir, "default")) {
if (xdg_cache) if (xdg_cache || !strcmp(cachedir, "xdg"))
slen = snprintf(NULL, 0, "%s/thumbnails/%s/%s.png", xdg_cache, dsize, md5)+1; slen = snprintf(NULL, 0, "%s/thumbnails/%s/%s.png", xdg_cache, dsize, md5)+1;
else else
slen = snprintf(NULL, 0, "%s/.thumbnails/%s/%s.png", home, dsize, md5)+1; slen = snprintf(NULL, 0, "%s/.thumbnails/%s/%s.png", home, dsize, md5)+1;
@ -256,7 +256,7 @@ void loadimagecache(const char *file, int *width, int *height) {
} }
if(!(buf = malloc(slen))) { if(!(buf = malloc(slen))) {
fprintf(stderr, "out of memory"); fprintf(stderr, "spmenu: out of memory");
return; return;
} }