Moved thumbnail cache to ~/.sxiv/cache/
This commit is contained in:
parent
d6a475e4b1
commit
b6a6c260e1
11
sxiv.1
11
sxiv.1
@ -308,7 +308,7 @@ Pan image left.
|
|||||||
Pan image right.
|
Pan image right.
|
||||||
.SH THUMBNAIL CACHING
|
.SH THUMBNAIL CACHING
|
||||||
To enable thumbnail caching, please make sure to create the directory
|
To enable thumbnail caching, please make sure to create the directory
|
||||||
.I ~/.sxiv/
|
.I ~/.sxiv/cache/
|
||||||
with write permissions. sxiv will then store all thumbnails inside this
|
with write permissions. sxiv will then store all thumbnails inside this
|
||||||
directory, but it will not create this directory by itself. It rather uses the
|
directory, but it will not create this directory by itself. It rather uses the
|
||||||
existance of this directory as an affirmation, that the user wants thumbnails
|
existance of this directory as an affirmation, that the user wants thumbnails
|
||||||
@ -321,15 +321,6 @@ Additionally, run the following command afterwards inside the cache directory
|
|||||||
to remove empty subdirectories:
|
to remove empty subdirectories:
|
||||||
.P
|
.P
|
||||||
.RS
|
.RS
|
||||||
find \-type d \-empty \-delete
|
|
||||||
.RE
|
|
||||||
.P
|
|
||||||
If the version of
|
|
||||||
.I find
|
|
||||||
installed on your local system does not support the \-delete option, then you
|
|
||||||
can also try the following command:
|
|
||||||
.P
|
|
||||||
.RS
|
|
||||||
find . \-depth \-type d \-empty ! \-name '.' \-exec rmdir {} \\;
|
find . \-depth \-type d \-empty ! \-name '.' \-exec rmdir {} \\;
|
||||||
.RE
|
.RE
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
|
12
thumbs.c
12
thumbs.c
@ -31,8 +31,10 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
const int thumb_dim = THUMB_SIZE + 10;
|
static const int thumb_dim = THUMB_SIZE + 10;
|
||||||
char *cache_dir = NULL;
|
|
||||||
|
static const char * const CACHE_DIR = ".sxiv/cache";
|
||||||
|
static char *cache_dir = NULL;
|
||||||
|
|
||||||
bool tns_cache_enabled(void) {
|
bool tns_cache_enabled(void) {
|
||||||
struct stat stats;
|
struct stat stats;
|
||||||
@ -175,9 +177,9 @@ void tns_init(tns_t *tns, int cnt, win_t *win) {
|
|||||||
if ((homedir = getenv("HOME")) != NULL) {
|
if ((homedir = getenv("HOME")) != NULL) {
|
||||||
if (cache_dir != NULL)
|
if (cache_dir != NULL)
|
||||||
free(cache_dir);
|
free(cache_dir);
|
||||||
len = strlen(homedir) + 10;
|
len = strlen(homedir) + strlen(CACHE_DIR) + 2;
|
||||||
cache_dir = (char*) s_malloc(len * sizeof(char));
|
cache_dir = (char*) s_malloc(len);
|
||||||
snprintf(cache_dir, len, "%s/.sxiv", homedir);
|
snprintf(cache_dir, len, "%s/%s", homedir, CACHE_DIR);
|
||||||
} else {
|
} else {
|
||||||
warn("could not locate thumbnail cache directory");
|
warn("could not locate thumbnail cache directory");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user