Fixes issue loading image cache data
With some versions of Glib/Glibmm library on MacOS, Glib::KeyFile "load_from_file" function does not raise a Glib::Error but another exception. This causes cached data not saved on disk (and thumbnails not displayed in explorer). Adds robustness testing if file is present first before calling the function
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <vector>
|
||||
#include <glib/gstdio.h>
|
||||
#include <glibmm/keyfile.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
#include "version.h"
|
||||
#include <locale.h>
|
||||
|
||||
@@ -250,7 +251,9 @@ int CacheImageData::save (const Glib::ustring& fname)
|
||||
Glib::KeyFile keyFile;
|
||||
|
||||
try {
|
||||
keyFile.load_from_file (fname);
|
||||
if (Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) {
|
||||
keyFile.load_from_file (fname);
|
||||
}
|
||||
} catch (Glib::Error&) {}
|
||||
|
||||
keyFile.set_string ("General", "MD5", md5);
|
||||
|
Reference in New Issue
Block a user