From 3c937549691e27789a26734b7771f69ac1633e12 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 11 Aug 2005 23:10:44 +0000 Subject: [PATCH] split CreateLocalProfileByID --- stepmania/src/ProfileManager.cpp | 22 ++++++++++++++++------ stepmania/src/ProfileManager.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index b30e830937..b2c28cf32a 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -371,15 +371,25 @@ bool ProfileManager::CreateLocalProfile( CString sName, CString &sProfileIDOut ) int iProfileNumber = iMaxProfileNumber + 1; CString sProfileID = ssprintf( "%08d", iProfileNumber ); - CString sProfileDir = LocalProfileIdToDir( sProfileID ); - bool bResult = Profile::CreateNewProfile( sProfileDir, sName, true ); - if( bResult ) - sProfileIDOut = sProfileID; - else + if( !CreateLocalProfileByID(sName, sProfileID) ) + { sProfileIDOut = ""; + return false; + } + + sProfileIDOut = sProfileID; + return true; +} + +bool ProfileManager::CreateLocalProfileByID( CString sName, CString sProfileID ) +{ + CString sProfileDir = LocalProfileIdToDir( sProfileID ); + if( !Profile::CreateNewProfile(sProfileDir, sName, true) ) + return false; + RefreshLocalProfilesFromDisk(); - return bResult; + return true; } bool ProfileManager::RenameLocalProfile( CString sProfileID, CString sNewName ) diff --git a/stepmania/src/ProfileManager.h b/stepmania/src/ProfileManager.h index 25e3b12ab2..b382c1f7a9 100644 --- a/stepmania/src/ProfileManager.h +++ b/stepmania/src/ProfileManager.h @@ -32,6 +32,7 @@ public: Profile &GetLocalProfile( const CString &sProfileID ); bool CreateLocalProfile( CString sName, CString &sProfileIDOut ); + bool CreateLocalProfileByID( CString sName, CString sProfileID ); bool RenameLocalProfile( CString sProfileID, CString sNewName ); bool DeleteLocalProfile( CString sProfileID ); void GetLocalProfileIDs( vector &vsProfileIDsOut ) const;