Fix overwriting, when installing PKG files

Now properly removes the directory and tries to continue installation.
This commit is contained in:
Raul Tambre 2014-08-23 10:30:26 +03:00
parent 0d43c822cd
commit ae47cdaad8

View file

@ -25,17 +25,16 @@ bool PKGLoader::Install(std::string dest)
std::string titleID = std::string(title_id).substr(7, 9); std::string titleID = std::string(title_id).substr(7, 9);
if (rExists(dest+titleID)) { if (rExists(dest + titleID)) {
rMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", rYES_NO|rCENTRE); rMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", rYES_NO|rCENTRE);
if (d_overwrite.ShowModal() != rID_YES) { if (d_overwrite.ShowModal() != rID_YES) {
LOG_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str()); LOG_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str());
return false; return false;
} }
// TODO: Remove the following two lines and remove the folder dest+titleID
LOG_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str()); rRmdir(dest + titleID);
return false;
} }
if (!rMkdir(dest+titleID)) { if (!rMkdir(dest + titleID)) {
LOG_ERROR(LOADER, "PKG Loader: Could not make the installation directory: %s", titleID.c_str()); LOG_ERROR(LOADER, "PKG Loader: Could not make the installation directory: %s", titleID.c_str());
return false; return false;
} }