From c9cc8494c91f398a114e85b17ba6020be79f079f Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 19 Oct 2020 17:16:57 +0200 Subject: [PATCH] Fixed an issue where gamelist changes would sometimes not be written to disk. --- USERGUIDE.md | 2 +- es-app/src/guis/GuiMenu.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/USERGUIDE.md b/USERGUIDE.md index 7100fbfbd..f0308553a 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -784,7 +784,7 @@ Can be set to Disabled, Default, Enhanced or Instant. Set to Disabled by default **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** diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 91ef90ae1..169d82d78 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -618,7 +618,18 @@ void GuiMenu::openOtherSettings() } s->addWithLabel("WHEN TO SAVE GAME METADATA", 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.