From 85242109690f159e66948408718ac12234902f3a Mon Sep 17 00:00:00 2001 From: Crash Cringle <30600688+CrashCringle12@users.noreply.github.com> Date: Tue, 1 Apr 2025 09:10:49 -0400 Subject: [PATCH] Change vector of vector of strings arrayGroupSongDirs to a map so we know precisely which directories are valid. --- src/SongManager.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/SongManager.cpp b/src/SongManager.cpp index 4defcb58c2..e28e667c69 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -381,7 +381,7 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio StripCvsAndSvn( arrayGroupDirs ); StripMacResourceForks( arrayGroupDirs ); - std::vector> arrayGroupSongDirs; + std::map> mapGroupSongDirs; int groupIndex, songCount, songIndex; groupIndex = 0; @@ -410,7 +410,7 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio StripMacResourceForks( arraySongDirs ); SortRStringArray( arraySongDirs ); - arrayGroupSongDirs.push_back(arraySongDirs); + mapGroupSongDirs[sGroupDirName] = arraySongDirs; songCount += arraySongDirs.size(); } } @@ -422,12 +422,11 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio ld->SetTotalWork( songCount ); } - groupIndex = 0; songIndex = 0; - - for (RString const &sGroupDirName : arrayGroupDirs) // foreach dir in /Songs/ + for (auto const &pair : mapGroupSongDirs) // foreach dir in /Songs/ { - std::vector &arraySongDirs = arrayGroupSongDirs[groupIndex++]; + RString sGroupDirName = pair.first; + std::vector arraySongDirs = pair.second; LOG->Trace("Attempting to load %i songs from \"%s\"", int(arraySongDirs.size()), (sDir+sGroupDirName).c_str() );