From f26497583424b13b60d4420294a0755316c85953 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 12 Aug 2005 19:12:20 +0000 Subject: [PATCH] delete profiles without reloading all old ones --- stepmania/src/ProfileManager.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 2871ce5439..c309b730ba 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -410,11 +410,21 @@ bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName ) bool ProfileManager::DeleteLocalProfile( CString sProfileID ) { - CString sProfileDir = LocalProfileIdToDir( sProfileID ); - bool bResult = DeleteRecursive( sProfileDir ); + map::iterator it = g_mapLocalProfileIdToProfile.find( sProfileID ); + if( it == g_mapLocalProfileIdToProfile.end() ) + { + LOG->Warn( "DeleteLocalProfile: ProfileID '%s' doesn't exist", sProfileID.c_str() ); + return false; + } - RefreshLocalProfilesFromDisk(); - return bResult; + CString sProfileDir = LocalProfileIdToDir( sProfileID ); + if( !DeleteRecursive(sProfileDir) ) + return false; + + delete it->second; + g_mapLocalProfileIdToProfile.erase( it ); + + return true; } void ProfileManager::SaveMachineProfile() const