From 9eba64adce6d6d4af66d6335ba061e9df810892a Mon Sep 17 00:00:00 2001 From: Andrew Pilley Date: Sun, 18 Feb 2024 07:38:47 +1100 Subject: Improve behavior when one or more firmware files can't be deleted. --- src/yuzu/main.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 58e23fc69..d3517b805 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -4187,7 +4187,7 @@ void GMainWindow::OnInstallFirmware() { LOG_INFO(Frontend, "Installing firmware from {}", firmware_source_location.toStdString()); - // Check for a resonable number of .nca files (don't hardcode them, just see if there's some in there. + // Check for a resonable number of .nca files (don't hardcode them, just see if there's some in there.) std::filesystem::path firmware_source_path = firmware_source_location.toStdString(); if (!Common::FS::IsDir(firmware_source_path)) { progress.close(); @@ -4195,7 +4195,6 @@ void GMainWindow::OnInstallFirmware() { } std::vector out; - const Common::FS::DirEntryCallable callback = [&out](const std::filesystem::directory_entry& entry) { if (entry.path().has_extension() && entry.path().extension() == ".nca") out.emplace_back(entry.path()); @@ -4215,11 +4214,15 @@ void GMainWindow::OnInstallFirmware() { // Locate and erase the content of nand/system/Content/registered/*.nca, if any. auto sysnand_content_vdir = system->GetFileSystemController().GetSystemNANDContentDirectory(); - if (sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) { - LOG_INFO(Frontend, - "Cleaned nand/system/Content/registered folder in preparation for new firmware."); + if (!sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) { + progress.close(); + QMessageBox::critical(this, tr("Firmware install failed"), tr("Failed to delete one or more firmware file.")); + return; } + LOG_INFO(Frontend, + "Cleaned nand/system/Content/registered folder in preparation for new firmware."); + QtProgressCallback(100, 20); auto firmware_vdir = sysnand_content_vdir->GetDirectoryRelative("registered"); @@ -4239,7 +4242,7 @@ void GMainWindow::OnInstallFirmware() { success = false; } - if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 70.0))) + if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 80.0))) { success = false; cancelled = true; -- cgit v1.2.3