mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Merge pull request #65 from jacobfk20/MetadataSaveOptimization
Fix for long exit times while saving metadata
This commit is contained in:
commit
77ad01c12c
|
@ -215,6 +215,12 @@ void updateGamelist(SystemData* system)
|
|||
{
|
||||
const char* tag = ((*fit)->getType() == GAME) ? "game" : "folder";
|
||||
|
||||
// check if current file has metadata, if no, skip it as it wont be in the gamelist anyway.
|
||||
if ((*fit)->metadata.isDefault()) {
|
||||
++fit;
|
||||
continue;
|
||||
}
|
||||
|
||||
// check if the file already exists in the XML
|
||||
// if it does, remove it before adding
|
||||
for(pugi::xml_node fileNode = root.child(tag); fileNode; fileNode = fileNode.next_sibling(tag))
|
||||
|
|
|
@ -133,3 +133,12 @@ boost::posix_time::ptime MetaDataList::getTime(const std::string& key) const
|
|||
{
|
||||
return string_to_ptime(get(key), "%Y%m%dT%H%M%S%F%q");
|
||||
}
|
||||
|
||||
bool MetaDataList::isDefault()
|
||||
{
|
||||
for (int i = 1; i < mMap.size(); i++) {
|
||||
if (mMap.at(gameDecls[i].key) != gameDecls[i].defaultValue) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
float getFloat(const std::string& key) const;
|
||||
boost::posix_time::ptime getTime(const std::string& key) const;
|
||||
|
||||
bool isDefault();
|
||||
|
||||
inline MetaDataListType getType() const { return mType; }
|
||||
inline const std::vector<MetaDataDecl>& getMDD() const { return getMDDByType(getType()); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue