diff options
author | Bert Münnich <be.muennich@gmail.com> | 2013-01-27 18:03:07 +0100 |
---|---|---|
committer | Bert Münnich <be.muennich@gmail.com> | 2013-01-27 18:03:07 +0100 |
commit | aa6ccf42b8aace05154bf2eebcba8695524b0b17 (patch) | |
tree | 79229fc6dd0bbbf7fde51a4614172cc5677a7c64 /thumbs.c | |
parent | 3a0a1ae889bc4de959cfe5079d541b0ec9119089 (diff) | |
parent | 9c0a53bc34c53424613ee203253fee526ba9f049 (diff) |
Merge branch 'userinfo'
Diffstat (limited to 'thumbs.c')
-rw-r--r-- | thumbs.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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"); } |