Change vector of vector of strings arrayGroupSongDirs to a map so we know precisely which directories are valid.

This commit is contained in:
Crash Cringle
2025-04-22 22:26:39 -07:00
committed by teejusb
parent 5e4f5ae4e5
commit 8524210969
+5 -6
View File
@@ -381,7 +381,7 @@ void SongManager::LoadSongDir( RString sDir, LoadingWindow *ld, bool onlyAdditio
StripCvsAndSvn( arrayGroupDirs );
StripMacResourceForks( arrayGroupDirs );
std::vector<std::vector<RString>> arrayGroupSongDirs;
std::map<RString, std::vector<RString>> 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<RString> &arraySongDirs = arrayGroupSongDirs[groupIndex++];
RString sGroupDirName = pair.first;
std::vector<RString> arraySongDirs = pair.second;
LOG->Trace("Attempting to load %i songs from \"%s\"", int(arraySongDirs.size()),
(sDir+sGroupDirName).c_str() );