mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Safeguard GameManager::Uninstall from calls with empty filename.
Could wipe all your games if a bug would cause this to happen.
This commit is contained in:
parent
15f45806b9
commit
3a6941c1ab
2 changed files with 9 additions and 3 deletions
|
@ -56,20 +56,26 @@ bool GameManager::DownloadAndInstall(std::string storeZipUrl) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void GameManager::Uninstall(std::string name) {
|
||||
bool GameManager::Uninstall(std::string name) {
|
||||
if (name.empty()) {
|
||||
ERROR_LOG(HLE, "Cannot remove an empty-named game");
|
||||
return false;
|
||||
}
|
||||
std::string gameDir = GetSysDirectory(DIRECTORY_GAME) + name;
|
||||
INFO_LOG(HLE, "Deleting %s", gameDir.c_str());
|
||||
if (!File::Exists(gameDir)) {
|
||||
ERROR_LOG(HLE, "Game %s not installed, cannot uninstall", name.c_str());
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool success = File::DeleteDirRecursively(gameDir);
|
||||
if (success) {
|
||||
INFO_LOG(HLE, "Successfully deleted game %s", name.c_str());
|
||||
g_Config.CleanRecent();
|
||||
return true;
|
||||
} else {
|
||||
ERROR_LOG(HLE, "Failed to delete game %s", name.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
// This starts off a background process.
|
||||
bool DownloadAndInstall(std::string storeZipUrl);
|
||||
void Uninstall(std::string name);
|
||||
bool Uninstall(std::string name);
|
||||
|
||||
// Call from time to time to check on completed downloads from the
|
||||
// main UI thread.
|
||||
|
|
Loading…
Add table
Reference in a new issue