From b1010041a2bf53c9c4456a36e43483f944d412af Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 14 Aug 2005 11:09:23 +0000 Subject: [PATCH] fix GetLocalProfile always fails due to mismatched slashes --- stepmania/src/ProfileManager.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 4ce2081205..66a838143d 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -28,9 +28,9 @@ ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program #define NEW_MEM_CARD_NAME "" -#define USER_PROFILES_DIR "Data/LocalProfiles/" -#define MACHINE_PROFILE_DIR "Data/MachineProfile/" -const CString LAST_GOOD_DIR = "LastGood/"; +#define USER_PROFILES_DIR "/Data/LocalProfiles/" +#define MACHINE_PROFILE_DIR "/Data/MachineProfile/" +const CString LAST_GOOD_SUBDIR = "LastGood/"; // Directories to search for a profile if m_sMemoryCardProfileSubdir doesn't @@ -94,10 +94,12 @@ void ProfileManager::Init() CreateLocalProfile( pCharacter->GetDisplayName(), sThrowAway ); } + ASSERT( (int)g_vLocalProfile.size() == NUM_FIXED_PROFILES ); + // apply fixed characters for( int i=0; iGetMetric( "ProfileManager", ssprintf("FixedProfileCharacterID%d",int(i+1)) ); + CString sCharacterID = FIXED_PROFILE_CHARACTER_ID( i ); g_vLocalProfile[i].profile.m_sCharacterID = sCharacterID; } } @@ -123,7 +125,7 @@ ProfileLoadResult ProfileManager::LoadProfile( PlayerNumber pn, CString sProfile // Try to load the original, non-backup data. ProfileLoadResult lr = GetProfile(pn)->LoadAllFromDir( m_sProfileDir[pn], PREFSMAN->m_bSignProfileData ); - CString sBackupDir = m_sProfileDir[pn] + LAST_GOOD_DIR; + CString sBackupDir = m_sProfileDir[pn] + LAST_GOOD_SUBDIR; // Save a backup of the non-backup profile now that we've loaded it and know // it's good. This should be reasonably fast because we're only saving Stats.xml @@ -364,7 +366,7 @@ void ProfileManager::RefreshLocalProfilesFromDisk() { g_vLocalProfile.push_back( DirAndProfile() ); DirAndProfile &dap = g_vLocalProfile.back(); - dap.sDir = *p; + dap.sDir = *p + "/"; dap.profile.LoadAllFromDir( *p, PREFSMAN->m_bSignProfileData ); } } @@ -374,7 +376,8 @@ const Profile *ProfileManager::GetLocalProfile( const CString &sProfileID ) cons CString sDir = LocalProfileIdToDir( sProfileID ); FOREACH_CONST( DirAndProfile, g_vLocalProfile, dap ) { - if( dap->sDir == sDir ) + const CString &sOther = dap->sDir; + if( sOther == sDir ) return &dap->profile; }