From ae47cdaad8a3e3269693514ee5515b75e32f474a Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Sat, 23 Aug 2014 10:30:26 +0300 Subject: [PATCH 1/2] Fix overwriting, when installing PKG files Now properly removes the directory and tries to continue installation. --- rpcs3/Loader/PKG.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rpcs3/Loader/PKG.cpp b/rpcs3/Loader/PKG.cpp index c07e43a5fa..2282c7541b 100644 --- a/rpcs3/Loader/PKG.cpp +++ b/rpcs3/Loader/PKG.cpp @@ -25,17 +25,16 @@ bool PKGLoader::Install(std::string dest) 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); if (d_overwrite.ShowModal() != rID_YES) { LOG_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str()); 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()); - return false; + + rRmdir(dest + titleID); } - if (!rMkdir(dest+titleID)) { + if (!rMkdir(dest + titleID)) { LOG_ERROR(LOADER, "PKG Loader: Could not make the installation directory: %s", titleID.c_str()); return false; } From 7a7264db330c1b5097a1a23fd7554cc0b5586fc9 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Sat, 23 Aug 2014 10:50:34 +0300 Subject: [PATCH 2/2] Use std::string for installing PKG files Also now only refreshes, when it could open the PKG file. --- rpcs3/Gui/MainFrame.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index fc79993072..af9e5d180a 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -233,18 +233,18 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event)) Emu.Stop(); // Open and install PKG file - wxString filePath = ctrl.GetPath(); - rFile pkg_f(filePath.ToStdString(), rFile::read); // TODO: Use VFS to install PKG files + std::string filePath = ctrl.GetPath().ToStdString(); + rFile pkg_f(filePath, rFile::read); // TODO: Use VFS to install PKG files if (pkg_f.IsOpened()) { PKGLoader pkg(pkg_f); pkg.Install("/dev_hdd0/game/"); pkg.Close(); - } - // Refresh game list - m_game_viewer->Refresh(); + // Refresh game list + m_game_viewer->Refresh(); + } } void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event))