COMMON: Add a helper to update a ConfMan entry and flush to disk

This commit is contained in:
Bastien Bouclet 2020-06-05 19:43:03 +02:00
parent b4e9f6696b
commit bad365c97e
3 changed files with 20 additions and 6 deletions

View file

@ -128,12 +128,7 @@ const String getGameGUIOptionsDescription(const String &options) {
void updateGameGUIOptions(const String &options, const String &langOption) {
const String newOptionString = getGameGUIOptionsDescription(options) + " " + langOption;
if ((!options.empty() && !ConfMan.hasKey("guioptions")) ||
(ConfMan.hasKey("guioptions") && ConfMan.get("guioptions") != newOptionString)) {
ConfMan.set("guioptions", newOptionString);
ConfMan.flushToDisk();
}
ConfMan.setAndFlush("guioptions", newOptionString);
}