mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-10-30 11:57:51 +00:00
Improve behavior when one or more firmware files can't be deleted.
This commit is contained in:
parent
e2e0916100
commit
9eba64adce
1 changed files with 9 additions and 6 deletions
|
@ -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<std::filesystem::path> 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;
|
||||
|
|
Loading…
Reference in a new issue