Fixed an issue where gamelist changes would sometimes not be written to disk.

This commit is contained in:
Leon Styhre 2020-10-19 17:16:57 +02:00
parent ca696e75cd
commit c9cc8494c9
2 changed files with 13 additions and 2 deletions

View file

@ -784,7 +784,7 @@ Can be set to Disabled, Default, Enhanced or Instant. Set to Disabled by default
**When to save metadata** **When to save metadata**
The metadata for a game is updated both by scraping and modifying data in the metadata editor, but also when launching a game, as the play count and last played date is then updated. This setting enables you to define when to write such metadata changes to the gamelist.xml files. Setting the option to "Never" will disable writing to these files altogether, except for some special conditions such as when a game is manually deleted using the metadata editor, or when scraping using the multi-scraper (the multi-scraper will always save any updates immediately to the gamelist.xml files). In theory "On exit" will give some performance gains, but it's normally recommended to leave the setting at its default value which is "Always". Note that with the settings set to "Never", any updates such as the last played date will still be shown on screen, however during the next application startup, any values previously saved to the gamelist.xml files will be read in again. The metadata for a game is updated both by scraping and modifying data in the metadata editor, but also when launching a game, as the play count and last played date is then updated. This setting enables you to define when to write such metadata changes to the gamelist.xml files. Setting the option to "Never" will disable writing to these files altogether, except for some special conditions such as when a game is manually deleted using the metadata editor, or when scraping using the multi-scraper (the multi-scraper will always save any updates immediately to the gamelist.xml files). In theory "On exit" will give some performance gains, but it's normally recommended to leave the setting at its default value which is "Always". Note that with the settings set to "Never", any updates such as the last played date will still be shown on screen, however during the next application startup, any values previously saved to the gamelist.xml files will be read in again. As well, when changing this setting to "Always" from either of the two other options, any pending changes will be immediately written to the gamelist.xml files.
**Game media directory** **Game media directory**

View file

@ -618,7 +618,18 @@ void GuiMenu::openOtherSettings()
} }
s->addWithLabel("WHEN TO SAVE GAME METADATA", gamelistsSaveMode); s->addWithLabel("WHEN TO SAVE GAME METADATA", gamelistsSaveMode);
s->addSaveFunc([gamelistsSaveMode] { s->addSaveFunc([gamelistsSaveMode] {
Settings::getInstance()->setString("SaveGamelistsMode", gamelistsSaveMode->getSelected()); if (Settings::getInstance()->getString("SaveGamelistsMode") !=
gamelistsSaveMode->getSelected()) {
Settings::getInstance()->setString("SaveGamelistsMode",
gamelistsSaveMode->getSelected());
// Always save the gamelist.xml files if switching to 'always' as there may
// be changes that will otherwise be lost.
if (Settings::getInstance()->getString("SaveGamelistsMode") == "always") {
for (auto it = SystemData::sSystemVector.cbegin();
it != SystemData::sSystemVector.cend(); it++)
(*it)->writeMetaData();
}
}
}); });
// Game media directory. // Game media directory.