rename profiles without reloading all old ones
assert
This commit is contained in:
@@ -377,6 +377,10 @@ bool ProfileManager::CreateLocalProfile( CString sName, CString &sProfileIDOut )
|
|||||||
|
|
||||||
bool ProfileManager::CreateLocalProfileByID( CString sName, CString sProfileID )
|
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 );
|
CString sProfileDir = LocalProfileIdToDir( sProfileID );
|
||||||
Profile *pProfile = Profile::CreateNewProfile( sProfileDir, sName, true );
|
Profile *pProfile = Profile::CreateNewProfile( sProfileDir, sName, true );
|
||||||
if( pProfile == NULL )
|
if( pProfile == NULL )
|
||||||
@@ -397,18 +401,11 @@ bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName )
|
|||||||
{
|
{
|
||||||
ASSERT( !sProfileID.empty() );
|
ASSERT( !sProfileID.empty() );
|
||||||
|
|
||||||
CString sProfileDir = LocalProfileIdToDir( sProfileID );
|
Profile &pro = ProfileManager::GetLocalProfile( sProfileID );
|
||||||
|
|
||||||
Profile pro;
|
|
||||||
Profile::LoadResult lr;
|
|
||||||
lr = pro.LoadAllFromDir( sProfileDir, PREFSMAN->m_bSignProfileData );
|
|
||||||
if( lr != Profile::success )
|
|
||||||
return false;
|
|
||||||
pro.m_sDisplayName = sNewName;
|
pro.m_sDisplayName = sNewName;
|
||||||
|
|
||||||
bool bResult = pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData );
|
CString sProfileDir = LocalProfileIdToDir( sProfileID );
|
||||||
RefreshLocalProfilesFromDisk();
|
return pro.SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData );
|
||||||
return bResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProfileManager::DeleteLocalProfile( CString sProfileID )
|
bool ProfileManager::DeleteLocalProfile( CString sProfileID )
|
||||||
|
|||||||
Reference in New Issue
Block a user