Changed the 'no games' dialog to no longer save the ROM directory to es_settings.xml if its value hasn't changed

This commit is contained in:
Leon Styhre 2023-07-30 00:04:09 +02:00
parent 42e3be2e2d
commit 99a0766dd9

View file

@ -188,22 +188,24 @@ void ViewController::noGamesDialog()
if (Settings::getInstance()->getBool("VirtualKeyboard")) { if (Settings::getInstance()->getBool("VirtualKeyboard")) {
mWindow->pushGui(new GuiTextEditKeyboardPopup( mWindow->pushGui(new GuiTextEditKeyboardPopup(
HelpStyle(), 0.0f, "ENTER ROM DIRECTORY PATH", currentROMDirectory, HelpStyle(), 0.0f, "ENTER ROM DIRECTORY PATH", currentROMDirectory,
[this](const std::string& newROMDirectory) { [this, currentROMDirectory](const std::string& newROMDirectory) {
Settings::getInstance()->setString("ROMDirectory", if (currentROMDirectory != newROMDirectory) {
Utils::String::trim(newROMDirectory)); Settings::getInstance()->setString(
Settings::getInstance()->saveFile(); "ROMDirectory", Utils::String::trim(newROMDirectory));
Settings::getInstance()->saveFile();
#if defined(_WIN64) #if defined(_WIN64)
mRomDirectory = mRomDirectory =
Utils::String::replace(FileData::getROMDirectory(), "/", "\\"); Utils::String::replace(FileData::getROMDirectory(), "/", "\\");
#else #else
mRomDirectory = FileData::getROMDirectory(); mRomDirectory = FileData::getROMDirectory();
#endif #endif
mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory); mNoGamesMessageBox->changeText(mNoGamesErrorMessage + mRomDirectory);
mWindow->pushGui(new GuiMsgBox(HelpStyle(), mWindow->pushGui(new GuiMsgBox(HelpStyle(),
"ROM DIRECTORY SETTING SAVED, RESTART\n" "ROM DIRECTORY SETTING SAVED, RESTART\n"
"THE APPLICATION TO RESCAN THE SYSTEMS", "THE APPLICATION TO RESCAN THE SYSTEMS",
"OK", nullptr, "", nullptr, "", nullptr, "OK", nullptr, "", nullptr, "", nullptr,
true, true)); true, true));
}
}, },
false, "SAVE", "SAVE CHANGES?", "Currently configured path:", false, "SAVE", "SAVE CHANGES?", "Currently configured path:",
currentROMDirectory, "LOAD CURRENTLY CONFIGURED PATH", currentROMDirectory, "LOAD CURRENTLY CONFIGURED PATH",