From 1b7c2a36d8408081c4f657e3911420893fd1ac3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 26 Jul 2021 22:15:34 +0200 Subject: [PATCH] UI message cleanup --- UI/MemStickScreen.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/UI/MemStickScreen.cpp b/UI/MemStickScreen.cpp index 65a8a85b76..1a7dc7ffaa 100644 --- a/UI/MemStickScreen.cpp +++ b/UI/MemStickScreen.cpp @@ -64,9 +64,7 @@ static bool SwitchMemstickFolderTo(Path newMemstickFolder) { File::CreateFullPath(newMemstickFolder); } if (!File::WriteDataToFile(true, "1", 1, testWriteFile)) { - // settingInfo_->Show(sy->T("ChangingMemstickPathInvalid", "That path couldn't be used to save Memory Stick files."), nullptr); - // TODO: Display an error! - return UI::EVENT_DONE; + return false; } File::Delete(testWriteFile); } else { @@ -150,8 +148,11 @@ UI::EventReturn MemStickScreen::OnUseInternalStorage(UI::EventParams ¶ms) { if (initialSetup_) { // There's not gonna be any files here in this case since it's a fresh install. // Let's just accept it and move on. No need to move files either. - SwitchMemstickFolderTo(pendingMemStickFolder_); - TriggerFinish(DialogResult::DR_OK); + if (SwitchMemstickFolderTo(pendingMemStickFolder_)) { + TriggerFinish(DialogResult::DR_OK); + } else { + // This can't really happen?? Not worth making an error message. + } } else { // Always ask for confirmation when called from the UI. Likely there's already some data. screenManager()->push(new ConfirmMemstickMoveScreen(pendingMemStickFolder_, false)); @@ -364,13 +365,15 @@ UI::EventReturn ConfirmMemstickMoveScreen::OnConfirm(UI::EventParams ¶ms) { } // Successful so far, switch the memstick folder. - SwitchMemstickFolderTo(newMemstickFolder_); + if (!SwitchMemstickFolderTo(newMemstickFolder_)) { + // TODO: More precise errors. + error_ = iz->T("That folder doesn't work as a memstick folder."); + return UI::EVENT_DONE; + } // If the chosen folder already had a config, reload it! g_Config.Load(); - - if (g_Config.Save("MemstickPathChanged")) { TriggerFinish(DialogResult::DR_OK); } else {