The loops here are handled.

This commit is contained in:
Jason Felds
2013-04-29 23:51:20 -04:00
parent b40bc42eda
commit 4b039a5628
+22 -22
View File
@@ -146,8 +146,8 @@ void BackgroundUtil::GetBackgroundEffects( const RString &_sName, vector<RString
GetDirListing( BACKGROUND_EFFECTS_DIR+sName+".lua", vsPathsOut, false, true ); GetDirListing( BACKGROUND_EFFECTS_DIR+sName+".lua", vsPathsOut, false, true );
vsNamesOut.clear(); vsNamesOut.clear();
FOREACH_CONST( RString, vsPathsOut, s ) for (RString const &s : vsPathsOut)
vsNamesOut.push_back( GetFileNameWithoutExtension(*s) ); vsNamesOut.push_back( GetFileNameWithoutExtension(s) );
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
@@ -164,8 +164,8 @@ void BackgroundUtil::GetBackgroundTransitions( const RString &_sName, vector<RSt
GetDirListing( BACKGROUND_TRANSITIONS_DIR+sName+".lua", vsPathsOut, false, true ); GetDirListing( BACKGROUND_TRANSITIONS_DIR+sName+".lua", vsPathsOut, false, true );
vsNamesOut.clear(); vsNamesOut.clear();
FOREACH_CONST( RString, vsPathsOut, s ) for (RString const &s : vsPathsOut)
vsNamesOut.push_back( GetFileNameWithoutExtension(*s) ); vsNamesOut.push_back( GetFileNameWithoutExtension(s) );
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
@@ -183,8 +183,8 @@ void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const RString &sMat
} }
vsNamesOut.clear(); vsNamesOut.clear();
FOREACH_CONST( RString, vsPathsOut, s ) for (RString const &s : vsPathsOut)
vsNamesOut.push_back( Basename(*s) ); vsNamesOut.push_back( Basename(s) );
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
@@ -205,8 +205,8 @@ void BackgroundUtil::GetSongMovies( const Song *pSong, const RString &sMatch, ve
} }
vsNamesOut.clear(); vsNamesOut.clear();
FOREACH_CONST( RString, vsPathsOut, s ) for (RString const &s : vsPathsOut)
vsNamesOut.push_back( Basename(*s) ); vsNamesOut.push_back( Basename(s) );
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
@@ -228,8 +228,8 @@ void BackgroundUtil::GetSongBitmaps( const Song *pSong, const RString &sMatch, v
} }
vsNamesOut.clear(); vsNamesOut.clear();
FOREACH_CONST( RString, vsPathsOut, s ) for (RString const &s : vsPathsOut)
vsNamesOut.push_back( Basename(*s) ); vsNamesOut.push_back( Basename(s) );
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
@@ -273,8 +273,8 @@ void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const RString &sM
GetDirListing( BG_ANIMS_DIR+sMatch+"*.xml", vsPathsOut, false, true ); GetDirListing( BG_ANIMS_DIR+sMatch+"*.xml", vsPathsOut, false, true );
vsNamesOut.clear(); vsNamesOut.clear();
FOREACH_CONST( RString, vsPathsOut, s ) for (RString const &s : vsPathsOut)
vsNamesOut.push_back( Basename(*s) ); vsNamesOut.push_back( Basename(s) );
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );
} }
@@ -316,22 +316,22 @@ namespace {
} }
vsDirsToTry.push_back( RANDOMMOVIES_DIR ); vsDirsToTry.push_back( RANDOMMOVIES_DIR );
FOREACH_CONST( RString, vsDirsToTry, sDir ) for (RString const &sDir : vsDirsToTry)
{ {
GetDirListing( *sDir+"*.ogv", vsPathsOut, false, true ); GetDirListing( sDir+"*.ogv", vsPathsOut, false, true );
GetDirListing( *sDir+"*.avi", vsPathsOut, false, true ); GetDirListing( sDir+"*.avi", vsPathsOut, false, true );
GetDirListing( *sDir+"*.mpg", vsPathsOut, false, true ); GetDirListing( sDir+"*.mpg", vsPathsOut, false, true );
GetDirListing( *sDir+"*.mpeg", vsPathsOut, false, true ); GetDirListing( sDir+"*.mpeg", vsPathsOut, false, true );
if( !ssFileNameWhitelist.empty() ) if( !ssFileNameWhitelist.empty() )
{ {
vector<RString> vsMatches; vector<RString> vsMatches;
FOREACH_CONST( RString, vsPathsOut, s ) for (RString const &s : vsPathsOut)
{ {
RString sBasename = Basename( *s ); RString sBasename = Basename( s );
bool bFound = ssFileNameWhitelist.find(sBasename) != ssFileNameWhitelist.end(); bool bFound = ssFileNameWhitelist.find(sBasename) != ssFileNameWhitelist.end();
if( bFound ) if( bFound )
vsMatches.push_back(*s); vsMatches.push_back(s);
} }
// If we found any that match the whitelist, use only them. // If we found any that match the whitelist, use only them.
// If none match the whitelist, ignore the whitelist.. // If none match the whitelist, ignore the whitelist..
@@ -362,9 +362,9 @@ void BackgroundUtil::GetGlobalRandomMovies(
GetGlobalRandomMoviePaths( pSong, sMatch, vsPathsOut, bTryInsideOfSongGroupAndGenreFirst, bTryInsideOfSongGroupFirst ); GetGlobalRandomMoviePaths( pSong, sMatch, vsPathsOut, bTryInsideOfSongGroupAndGenreFirst, bTryInsideOfSongGroupFirst );
FOREACH_CONST( RString, vsPathsOut, s ) for (RString const &s : vsPathsOut)
{ {
RString sName = s->Right( s->size() - RANDOMMOVIES_DIR.size() - 1 ); RString sName = s.Right( s.size() - RANDOMMOVIES_DIR.size() - 1 );
vsNamesOut.push_back( sName ); vsNamesOut.push_back( sName );
} }
StripCvsAndSvn( vsPathsOut, vsNamesOut ); StripCvsAndSvn( vsPathsOut, vsNamesOut );