merged dev into locallab_dev
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
#include "options.h"
|
||||
#include "procparamchangers.h"
|
||||
#include "thumbnail.h"
|
||||
|
||||
#include "md5helper.h"
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -314,44 +314,6 @@ void CacheManager::deleteFiles (const Glib::ustring& fname, const std::string& m
|
||||
}
|
||||
}
|
||||
|
||||
std::string CacheManager::getMD5 (const Glib::ustring& fname)
|
||||
{
|
||||
|
||||
auto file = Gio::File::create_for_path (fname);
|
||||
|
||||
if (file && file->query_exists ()) {
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
std::unique_ptr<wchar_t, GFreeFunc> wfname (reinterpret_cast<wchar_t*> (g_utf8_to_utf16 (fname.c_str (), -1, NULL, NULL, NULL)), g_free);
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileAttr;
|
||||
|
||||
if (GetFileAttributesExW (wfname.get (), GetFileExInfoStandard, &fileAttr)) {
|
||||
// We use name, size and creation time to identify a file.
|
||||
const auto identifier = Glib::ustring::compose ("%1-%2-%3-%4", fileAttr.nFileSizeLow, fileAttr.ftCreationTime.dwHighDateTime, fileAttr.ftCreationTime.dwLowDateTime, fname);
|
||||
return Glib::Checksum::compute_checksum (Glib::Checksum::CHECKSUM_MD5, identifier);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
try {
|
||||
|
||||
if (auto info = file->query_info ()) {
|
||||
// We only use name and size to identify a file.
|
||||
const auto identifier = Glib::ustring::compose ("%1%2", fname, info->get_size ());
|
||||
return Glib::Checksum::compute_checksum (Glib::Checksum::CHECKSUM_MD5, identifier);
|
||||
}
|
||||
|
||||
} catch (Gio::Error&) {}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Glib::ustring CacheManager::getCacheFileName (const Glib::ustring& subDir,
|
||||
const Glib::ustring& fname,
|
||||
const Glib::ustring& fext,
|
||||
|
Reference in New Issue
Block a user