Krolyxon
Commit e648c11

Branches

Refs →

nsxive648c11

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.
Author
Kacper Gutowski
Date
2018-07-05 02:57 +0200
Committer
Bert Münnich · 2018-07-30 10:33 +0200
Parent
e6c9218
Commit
e648c11899392e8377dff2b12fd3752046a85bac

+2 −11

1 file changed

  1. M thumbs.c +2 −11
M thumbs.c View
@@ -120,8 +120,7 @@ void tns_cache_write(Imlib_Image im, const char *filepath, bool force)
120120 void tns_clean_cache(tns_t *tns)
121121 {
122122 int dirlen;
123− bool delete;
124− char *cfile, *filename, *tpos;
123+ char *cfile, *filename;
125124 r_dir_t dir;
126125
127126 if (r_opendir(&dir, cache_dir, true) < 0) {
@@ -133,15 +132,7 @@ void tns_clean_cache(tns_t *tns)
133132
134133 while ((cfile = r_readdir(&dir, false)) != NULL) {
135134 filename = cfile + dirlen;
136− delete = false;
137−
138− if ((tpos = strrchr(filename, '.')) != NULL) {
139− *tpos = '\0';
140− if (access(filename, F_OK) < 0)
141− delete = true;
142− *tpos = '.';
143− }
144− if (delete) {
135+ if (access(filename, F_OK) < 0) {
145136 if (unlink(cfile) < 0)
146137 error(0, errno, "%s", cfile);
147138 }