瀏覽代碼

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.
master
Kacper Gutowski Bert Münnich 6 年之前
父節點
當前提交
e648c11899
共有 1 個文件被更改,包括 2 次插入11 次删除
  1. +2
    -11
      thumbs.c

+ 2
- 11
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);
}


Loading…
取消
儲存