From 6fd63045024dc9905c15a27791d86dfeeaf2aaf7 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 12 Aug 2005 19:05:38 +0000 Subject: [PATCH] rename profiles without reloading all old ones assert --- stepmania/src/ProfileManager.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 28350cd966..2871ce5439 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -377,6 +377,10 @@ bool ProfileManager::CreateLocalProfile( CString sName, CString &sProfileIDOut ) bool ProfileManager::CreateLocalProfileByID( CString sName, CString sProfileID ) { + ASSERT_M( g_mapLocalProfileIdToProfile.find(sProfileID) == g_mapLocalProfileIdToProfile.end(), + ssprintf("creating \"%s\" \"%s\" that already exists", + sName.c_str(), sProfileID.c_str()) ); + CString sProfileDir = LocalProfileIdToDir( sProfileID ); Profile *pProfile = Profile::CreateNewProfile( sProfileDir, sName, true ); if( pProfile == NULL ) @@ -397,18 +401,11 @@ bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName ) { ASSERT( !sProfileID.empty() ); - CString sProfileDir = LocalProfileIdToDir( sProfileID ); - - Profile pro; - Profile::LoadResult lr; - lr = pro.LoadAllFromDir( sProfileDir, PREFSMAN->m_bSignProfileData ); - if( lr != Profile::success ) - return false; + Profile &pro = ProfileManager::GetLocalProfile( sProfileID ); pro.m_sDisplayName = sNewName; - bool bResult = pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData ); - RefreshLocalProfilesFromDisk(); - return bResult; + CString sProfileDir = LocalProfileIdToDir( sProfileID ); + return pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData ); } bool ProfileManager::DeleteLocalProfile( CString sProfileID )