fix GetDirListingRecursive adding redundant files
This commit is contained in:
@@ -857,34 +857,42 @@ void GetDirListing( const RString &sPath, vector<RString> &AddTo, bool bOnlyDirs
|
|||||||
void GetDirListingRecursive( const RString &sDir, const RString &sMatch, vector<RString> &AddTo )
|
void GetDirListingRecursive( const RString &sDir, const RString &sMatch, vector<RString> &AddTo )
|
||||||
{
|
{
|
||||||
ASSERT( sDir.Right(1) == "/" );
|
ASSERT( sDir.Right(1) == "/" );
|
||||||
GetDirListing( sDir+sMatch, AddTo, false, true );
|
vector<RString> vsFiles;
|
||||||
GetDirListing( sDir+"*", AddTo, true, true );
|
GetDirListing( sDir+sMatch, vsFiles, false, true );
|
||||||
for( unsigned i=0; i<AddTo.size(); i++ )
|
vector<RString> vsDirs;
|
||||||
|
GetDirListing( sDir+"*", vsDirs, true, true );
|
||||||
|
for( int i=0; i<(int)vsDirs.size(); i++ )
|
||||||
{
|
{
|
||||||
if( IsADirectory( AddTo[i] ) )
|
GetDirListing( vsDirs[i]+"/"+sMatch, vsFiles, false, true );
|
||||||
{
|
GetDirListing( vsDirs[i]+"/*", vsDirs, true, true );
|
||||||
GetDirListing( AddTo[i]+"/"+sMatch, AddTo, false, true );
|
vsDirs.erase( vsDirs.begin()+i );
|
||||||
GetDirListing( AddTo[i]+"/*", AddTo, true, true );
|
i--;
|
||||||
AddTo.erase( AddTo.begin()+i );
|
}
|
||||||
i--;
|
for( int i=vsFiles.size()-1; i>=0; i-- )
|
||||||
}
|
{
|
||||||
|
if( !IsADirectory(vsFiles[i]) )
|
||||||
|
AddTo.push_back( vsFiles[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetDirListingRecursive( RageFileDriver *prfd, const RString &sDir, const RString &sMatch, vector<RString> &AddTo )
|
void GetDirListingRecursive( RageFileDriver *prfd, const RString &sDir, const RString &sMatch, vector<RString> &AddTo )
|
||||||
{
|
{
|
||||||
ASSERT( sDir.Right(1) == "/" );
|
ASSERT( sDir.Right(1) == "/" );
|
||||||
prfd->GetDirListing( sDir+sMatch, AddTo, false, true );
|
vector<RString> vsFiles;
|
||||||
prfd->GetDirListing( sDir+"*", AddTo, true, true );
|
prfd->GetDirListing( sDir+sMatch, vsFiles, false, true );
|
||||||
for( unsigned i=0; i<AddTo.size(); i++ )
|
vector<RString> vsDirs;
|
||||||
|
prfd->GetDirListing( sDir+"*", vsDirs, true, true );
|
||||||
|
for( int i=0; i<(int)vsDirs.size(); i++ )
|
||||||
{
|
{
|
||||||
if( prfd->GetFileType(AddTo[i]) == RageFileManager::TYPE_DIR )
|
prfd->GetDirListing( vsDirs[i]+"/"+sMatch, vsFiles, false, true );
|
||||||
{
|
prfd->GetDirListing( vsDirs[i]+"/*", vsDirs, true, true );
|
||||||
prfd->GetDirListing( AddTo[i]+"/"+sMatch, AddTo, false, true );
|
vsDirs.erase( vsDirs.begin()+i );
|
||||||
prfd->GetDirListing( AddTo[i]+"/*", AddTo, true, true );
|
i--;
|
||||||
AddTo.erase( AddTo.begin()+i );
|
}
|
||||||
i--;
|
for( int i=vsFiles.size()-1; i>=0; i-- )
|
||||||
}
|
{
|
||||||
|
if( prfd->GetFileType(vsFiles[i]) != RageFileManager::TYPE_DIR )
|
||||||
|
AddTo.push_back( vsFiles[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user