summaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorBert Münnich <be.muennich@gmail.com>2013-01-08 20:55:02 +0100
committerBert Münnich <be.muennich@gmail.com>2013-01-12 23:40:16 +0100
commitb6a6c260e1876172c764c6eca3aae004026cd8aa (patch)
treea64e1f304ad34bfb1c8458bb5ffe2a2e8857634e /thumbs.c
parentd6a475e4b1c0d5025806c4a6e47c68e46a3c31d9 (diff)
downloadnsxiv-b6a6c260e1876172c764c6eca3aae004026cd8aa.tar.zst
Moved thumbnail cache to ~/.sxiv/cache/
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/thumbs.c b/thumbs.c
index 5dec4a5..5453815 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -31,8 +31,10 @@
#include "util.h"
#include "config.h"
-const int thumb_dim = THUMB_SIZE + 10;
-char *cache_dir = NULL;
+static const int thumb_dim = THUMB_SIZE + 10;
+
+static const char * const CACHE_DIR = ".sxiv/cache";
+static char *cache_dir = NULL;
bool tns_cache_enabled(void) {
struct stat stats;
@@ -175,9 +177,9 @@ void tns_init(tns_t *tns, int cnt, win_t *win) {
if ((homedir = getenv("HOME")) != NULL) {
if (cache_dir != NULL)
free(cache_dir);
- len = strlen(homedir) + 10;
- cache_dir = (char*) s_malloc(len * sizeof(char));
- snprintf(cache_dir, len, "%s/.sxiv", homedir);
+ len = strlen(homedir) + strlen(CACHE_DIR) + 2;
+ cache_dir = (char*) s_malloc(len);
+ snprintf(cache_dir, len, "%s/%s", homedir, CACHE_DIR);
} else {
warn("could not locate thumbnail cache directory");
}