diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-16 19:13:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-16 19:13:21 +0400 |
commit | 0f7ab89b4ee803aa9cb2182eb6f394d2cf28de56 (patch) | |
tree | fe453180733b42277aac112d0240bd2323df30e4 /source/blender | |
parent | e0605cca9a09d9d33974f7beea3acbb1741b476e (diff) |
fix for fail thumbs being used when the failed thumbnail image is older then the image/movie/blend.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 1 | ||||
-rw-r--r-- | source/blender/imbuf/intern/thumbs.c | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 9bcbdcce12e..f4070f76519 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -551,6 +551,7 @@ void BLI_file_free_lines(LinkNode *lines) BLI_linklist_free(lines, (void(*)(void*)) MEM_freeN); } +/** is file1 older then file2 */ int BLI_file_older(const char *file1, const char *file2) { #ifdef WIN32 diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 5c54fbab0cf..5d64e1b2aec 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -223,6 +223,8 @@ static void thumbname_from_uri(const char* uri, char* thumb, const int thumb_len to_hex_char(hexdigest, digest, 16); hexdigest[32] = '\0'; BLI_snprintf(thumb, thumb_len, "%s.png", hexdigest); + + // printf("%s: '%s' --> '%s'\n", __func__, uri, thumb); } static int thumbpath_from_uri(const char* uri, char* path, const int path_len, ThumbSize size) @@ -378,7 +380,9 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im if (IMB_saveiff(img, temp, IB_rect | IB_metadata)) { #ifndef WIN32 chmod(temp, S_IRUSR | S_IWUSR); -#endif +#endif + // printf("%s saving thumb: '%s'\n", __func__, tpath); + BLI_rename(temp, tpath); } @@ -441,7 +445,13 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source) if (thumbpath_from_uri(uri, thumb, sizeof(thumb), THB_FAIL)) { /* failure thumb exists, don't try recreating */ if (BLI_exists(thumb)) { - return NULL; + /* clear out of date fail case */ + if (BLI_file_older(thumb, path)) { + BLI_delete(thumb, 0, 0); + } + else { + return NULL; + } } } |