Handle cleanup before installs and after failed installs

This commit is contained in:
d0k3 2020-08-14 12:29:00 +02:00
parent 4af0268e5a
commit 99b69754b2

View File

@ -2300,6 +2300,10 @@ u32 InstallGameFile(const char* path, bool to_emunand) {
// check permissions for SysNAND (this includes everything we need) // check permissions for SysNAND (this includes everything we need)
if (!CheckWritePermissions(to_emunand ? "4:" : "1:")) return 1; if (!CheckWritePermissions(to_emunand ? "4:" : "1:")) return 1;
// cleanup content folder before starting install
ShowProgress(0, 0, path);
UninstallGameData(tid64, false, false, false, to_emunand);
// install game file // install game file
if (filetype & GAME_CIA) if (filetype & GAME_CIA)
@ -2314,9 +2318,8 @@ u32 InstallGameFile(const char* path, bool to_emunand) {
ret = BuildInstallFromNdsFile(path, drv, true); ret = BuildInstallFromNdsFile(path, drv, true);
else ret = 1; else ret = 1;
// we have no clue what to do on failure // cleanup on failed installs, but leave ticket and save untouched
// if (ret != 0) ... if (ret != 0) UninstallGameData(tid64, true, false, false, to_emunand);
// maybe just uninstall?
return ret; return ret;
} }