Merge pull request #6168 from PabloMK7/cia_update_fix

Fix handling of auto-updating ncch apps
This commit is contained in:
GPUCode 2022-11-09 17:35:16 +02:00 committed by GitHub
commit 38b8bf12de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 10 deletions

View file

@ -315,7 +315,14 @@ bool CIAFile::Close() const {
if (abort)
break;
FileUtil::Delete(GetTitleContentPath(media_type, old_tmd.GetTitleID(), old_index));
// If the file to delete is the current launched rom, signal the system to delete
// the current rom instead of deleting it now, once all the handles to the file
// are closed.
std::string to_delete =
GetTitleContentPath(media_type, old_tmd.GetTitleID(), old_index);
if (!(Core::System::GetInstance().IsPoweredOn() &&
Core::System::GetInstance().SetSelfDelete(to_delete)))
FileUtil::Delete(to_delete);
}
FileUtil::Delete(old_tmd_path);