Fix self-delete to run only after successful extraction (v1.1.1).
All checks were successful
Build NRO / build (push) Successful in 1m44s

Only remove PatchExtractor.nro on exit when the Done screen was reached;
early quit no longer deletes the NRO. Drop the ineffective mid-run self-delete.
This commit is contained in:
2026-05-28 22:46:02 +02:00
parent c525a80e6e
commit abea3f8765
6 changed files with 17 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ include $(DEVKITPRO)/libnx/switch_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
APP_TITLE := PatchExtractor APP_TITLE := PatchExtractor
APP_AUTHOR := NiklasCFW APP_AUTHOR := NiklasCFW
APP_VERSION := 1.1.0 APP_VERSION := 1.1.1
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR)) TARGET := $(notdir $(CURDIR))

View File

@@ -7,7 +7,7 @@ Nintendo Switch Homebrew App für [OmniNX OC](https://git.niklascfw.de/OmniNX/Om
1. Sucht nach `sd:/SaltySD/plugins/FPSLocker/patches.zip` 1. Sucht nach `sd:/SaltySD/plugins/FPSLocker/patches.zip`
2. Entpackt alle Patches in das gleiche Verzeichnis (überschreibt existierende Dateien) 2. Entpackt alle Patches in das gleiche Verzeichnis (überschreibt existierende Dateien)
3. Löscht `patches.zip` nach erfolgreichem Entpacken 3. Löscht `patches.zip` nach erfolgreichem Entpacken
4. Löscht `sd:/switch/PatchExtractor.nro` beim Beenden (nach `romfsExit`, da eingebettetes ROMFS die Datei sonst offen hält) 4. Löscht `sd:/switch/PatchExtractor.nro` nur beim Beenden nach erfolgreichem Entpacken (Fertig-Bildschirm)
## Nutzung ## Nutzung

View File

@@ -116,9 +116,6 @@ bool PatchExtractor::cleanup() {
if (remove(PATCHES_ZIP) != 0) if (remove(PATCHES_ZIP) != 0)
cleanupOk_ = false; cleanupOk_ = false;
// Cannot delete our own NRO while the app is still running; try anyway for edge cases.
remove(SELF_NRO);
remove("sdmc:/switch/.PatchExtractor.nro.star"); remove("sdmc:/switch/.PatchExtractor.nro.star");
remove("sdmc:/switch/.packages/boot_package.ini"); remove("sdmc:/switch/.packages/boot_package.ini");

View File

@@ -20,6 +20,8 @@ int main(int argc, char* argv[]) {
while (brls::Application::mainLoop()) {} while (brls::Application::mainLoop()) {}
PatchExtractor::tryDeleteSelfOnExit(); if (PatchActivity::shouldDeleteSelfOnExit())
PatchExtractor::tryDeleteSelfOnExit();
return 0; return 0;
} }

View File

@@ -2,6 +2,14 @@
#include <cstdio> #include <cstdio>
namespace {
bool g_deleteSelfOnExit = false;
}
bool PatchActivity::shouldDeleteSelfOnExit() {
return g_deleteSelfOnExit;
}
PatchActivity::PatchActivity() { PatchActivity::PatchActivity() {
extractor = std::make_unique<PatchExtractor>(); extractor = std::make_unique<PatchExtractor>();
@@ -128,6 +136,7 @@ void PatchActivity::showScreen(Screen screen) {
break; break;
case Screen::Done: { case Screen::Done: {
g_deleteSelfOnExit = true;
titleLabel->setText("Fertig"); titleLabel->setText("Fertig");
const unsigned long ok = extractor->getExtracted() - extractor->getSkipped(); const unsigned long ok = extractor->getExtracted() - extractor->getSkipped();
char msg[128]; char msg[128];

View File

@@ -13,6 +13,9 @@ public:
brls::View* createContentView() override; brls::View* createContentView() override;
void onContentAvailable() override; void onContentAvailable() override;
/** True only after a finished extraction (Done screen was reached). */
static bool shouldDeleteSelfOnExit();
private: private:
enum class Screen { Error, Ready, Extracting, Done }; enum class Screen { Error, Ready, Extracting, Done };