Merge pull request #4908 from Beep6581/getridoffeahistogramcache
Get rid of aehistogram files in RT cache. Merged to get more tests. Issue and pr stay open for a while
This commit is contained in:
@@ -57,7 +57,9 @@ void CacheManager::init ()
|
||||
auto error = g_mkdir_with_parents (baseDir.c_str(), cacheDirMode);
|
||||
|
||||
for (const auto& cacheDir : cacheDirs) {
|
||||
error |= g_mkdir_with_parents (Glib::build_filename (baseDir, cacheDir).c_str(), cacheDirMode);
|
||||
if (strncmp(cacheDir, "aehistograms", 12)) { // don't create aehistograms folder.
|
||||
error |= g_mkdir_with_parents (Glib::build_filename (baseDir, cacheDir).c_str(), cacheDirMode);
|
||||
}
|
||||
}
|
||||
|
||||
if (error != 0 && options.rtSettings.verbose) {
|
||||
@@ -183,9 +185,6 @@ void CacheManager::renameEntry (const std::string& oldfilename, const std::strin
|
||||
|
||||
auto error = g_rename (getCacheFileName ("profiles", oldfilename, paramFileExtension, oldmd5).c_str (), getCacheFileName ("profiles", newfilename, paramFileExtension, newmd5).c_str ());
|
||||
error |= g_rename (getCacheFileName ("images", oldfilename, ".rtti", oldmd5).c_str (), getCacheFileName ("images", newfilename, ".rtti", newmd5).c_str ());
|
||||
error |= g_rename (getCacheFileName ("images", oldfilename, ".cust16", oldmd5).c_str (), getCacheFileName ("images", newfilename, ".cust16", newmd5).c_str ());
|
||||
error |= g_rename (getCacheFileName ("images", oldfilename, ".cust", oldmd5).c_str (), getCacheFileName ("images", newfilename, ".cust", newmd5).c_str ());
|
||||
error |= g_rename (getCacheFileName ("images", oldfilename, ".jpg", oldmd5).c_str (), getCacheFileName ("images", newfilename, ".jpg", newmd5).c_str ());
|
||||
error |= g_rename (getCacheFileName ("aehistograms", oldfilename, "", oldmd5).c_str (), getCacheFileName ("aehistograms", newfilename, "", newmd5).c_str ());
|
||||
error |= g_rename (getCacheFileName ("embprofiles", oldfilename, ".icc", oldmd5).c_str (), getCacheFileName ("embprofiles", newfilename, ".icc", newmd5).c_str ());
|
||||
error |= g_rename (getCacheFileName ("data", oldfilename, ".txt", oldmd5).c_str (), getCacheFileName ("data", newfilename, ".txt", newmd5).c_str ());
|
||||
@@ -238,6 +237,7 @@ void CacheManager::clearImages () const
|
||||
{
|
||||
MyMutex::MyLock lock (mutex);
|
||||
|
||||
deleteDir ("data");
|
||||
deleteDir ("images");
|
||||
deleteDir ("aehistograms");
|
||||
deleteDir ("embprofiles");
|
||||
@@ -275,9 +275,6 @@ void CacheManager::deleteFiles (const Glib::ustring& fname, const std::string& m
|
||||
}
|
||||
|
||||
auto error = g_remove (getCacheFileName ("images", fname, ".rtti", md5).c_str ());
|
||||
error |= g_remove (getCacheFileName ("images", fname, ".cust16", md5).c_str ());
|
||||
error |= g_remove (getCacheFileName ("images", fname, ".cust", md5).c_str ());
|
||||
error |= g_remove (getCacheFileName ("images", fname, ".jpg", md5).c_str ());
|
||||
error |= g_remove (getCacheFileName ("aehistograms", fname, "", md5).c_str ());
|
||||
error |= g_remove (getCacheFileName ("embprofiles", fname, ".icc", md5).c_str ());
|
||||
|
||||
|
@@ -855,8 +855,10 @@ void Thumbnail::_loadThumbnail(bool firstTrial)
|
||||
}
|
||||
|
||||
if ( cfs.thumbImgType == CacheImageData::FULL_THUMBNAIL ) {
|
||||
// load aehistogram
|
||||
tpp->readAEHistogram (getCacheFileName ("aehistograms", ""));
|
||||
if(!tpp->isAeValid()) {
|
||||
// load aehistogram
|
||||
tpp->readAEHistogram (getCacheFileName ("aehistograms", ""));
|
||||
}
|
||||
|
||||
// load embedded profile
|
||||
tpp->readEmbProfile (getCacheFileName ("embprofiles", ".icc"));
|
||||
@@ -898,19 +900,15 @@ void Thumbnail::_saveThumbnail ()
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_remove (getCacheFileName ("images", ".rtti").c_str ()) != 0) {
|
||||
// No file deleted, so we try to deleted obsolete files, if any
|
||||
g_remove (getCacheFileName ("images", ".cust").c_str ());
|
||||
g_remove (getCacheFileName ("images", ".cust16").c_str ());
|
||||
g_remove (getCacheFileName ("images", ".jpg").c_str ());
|
||||
}
|
||||
g_remove (getCacheFileName ("images", ".rtti").c_str ());
|
||||
|
||||
// save thumbnail image
|
||||
tpp->writeImage (getCacheFileName ("images", ""));
|
||||
|
||||
// save aehistogram
|
||||
tpp->writeAEHistogram (getCacheFileName ("aehistograms", ""));
|
||||
|
||||
if(!tpp->isAeValid()) {
|
||||
// save aehistogram
|
||||
tpp->writeAEHistogram (getCacheFileName ("aehistograms", ""));
|
||||
}
|
||||
// save embedded profile
|
||||
tpp->writeEmbProfile (getCacheFileName ("embprofiles", ".icc"));
|
||||
|
||||
|
Reference in New Issue
Block a user