aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKacper Gutowski <klg@mmax.one.pl>2018-07-05 02:57:32 +0200
committerBert Münnich <ber.t@posteo.de>2018-07-30 10:33:23 +0200
commite648c11899392e8377dff2b12fd3752046a85bac (patch)
treee1f001ff32e323ca08f4c3ed6895e88575fad584
parente6c9218319b82b875ffb0c15dd88f8f6e77c50e2 (diff)
Respect updated path format when cleaning cache
Since d8114e8 the file name is used for caching as-is without adding .jpg at the end, but sxiv -c still expected old format causing it to remove all fresh thumbnails.
-rw-r--r--thumbs.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/thumbs.c b/thumbs.c
index b9320e7..c389b39 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -120,8 +120,7 @@ void tns_cache_write(Imlib_Image im, const char *filepath, bool force)
void tns_clean_cache(tns_t *tns)
{
int dirlen;
- bool delete;
- char *cfile, *filename, *tpos;
+ char *cfile, *filename;
r_dir_t dir;
if (r_opendir(&dir, cache_dir, true) < 0) {
@@ -133,15 +132,7 @@ void tns_clean_cache(tns_t *tns)
while ((cfile = r_readdir(&dir, false)) != NULL) {
filename = cfile + dirlen;
- delete = false;
-
- if ((tpos = strrchr(filename, '.')) != NULL) {
- *tpos = '\0';
- if (access(filename, F_OK) < 0)
- delete = true;
- *tpos = '.';
- }
- if (delete) {
+ if (access(filename, F_OK) < 0) {
if (unlink(cfile) < 0)
error(0, errno, "%s", cfile);
}