diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index c99022ead2..17486243cd 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -1183,30 +1183,34 @@ void SongManager::LoadAllFromProfile( ProfileSlot s ) CString sProfileDir = PROFILEMAN->GetProfileDir( s ); if( sProfileDir.empty() ) return; // skip + + LoadEditsFromDir( sProfileDir, s ); +} + +void SongManager::LoadEditsFromDir( const CString &sDir, ProfileSlot slot ) +{ // // Load all .edit files. // + CString sEditsDir = sDir+"Edits/"; + + CStringArray asEditsFilesWithPath; + GetDirListing( sEditsDir+"*.edit", asEditsFilesWithPath, false, true ); + + unsigned size = min( asEditsFilesWithPath.size(), (unsigned)MAX_EDITS_PER_PROFILE ); + + for( unsigned i=0; iGetFileSizeInBytes( fn ); + if( iBytes > MAX_EDIT_SIZE_BYTES ) { - CString fn = asEditsFilesWithPath[i]; - - int iBytes = FILEMAN->GetFileSizeInBytes( fn ); - if( iBytes > MAX_EDIT_SIZE_BYTES ) - { - LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() ); - continue; - } - - SMLoader::LoadEdit( fn, s ); + LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() ); + continue; } + + SMLoader::LoadEdit( fn, slot ); } } diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index 103f872763..ad8b3744fb 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -35,6 +35,7 @@ public: void SetPreferences(); void LoadAllFromProfile( ProfileSlot s ); // songs, edits + void LoadEditsFromDir( const CString &sDir, ProfileSlot slot ); int GetNumStepsLoadedFromProfile(); void FreeAllLoadedFromProfiles();