cleanup
This commit is contained in:
@@ -234,30 +234,27 @@ void FilenameDB::GetFilesEqualTo( const CString &sDir, const CString &sFile, vec
|
|||||||
void FilenameDB::GetFilesSimpleMatch( const CString &sDir, const CString &sMask, vector<CString> &asOut, bool bOnlyDirs )
|
void FilenameDB::GetFilesSimpleMatch( const CString &sDir, const CString &sMask, vector<CString> &asOut, bool bOnlyDirs )
|
||||||
{
|
{
|
||||||
/* Does this contain a wildcard? */
|
/* Does this contain a wildcard? */
|
||||||
size_t first_pos = sMask.find_first_of('*');
|
size_t first_pos = sMask.find_first_of( '*' );
|
||||||
if( first_pos == sMask.npos )
|
if( first_pos == sMask.npos )
|
||||||
{
|
{
|
||||||
/* No; just do a regular search. */
|
/* No; just do a regular search. */
|
||||||
GetFilesEqualTo( sDir, sMask, asOut, bOnlyDirs );
|
GetFilesEqualTo( sDir, sMask, asOut, bOnlyDirs );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
size_t second_pos = sMask.find_first_of( '*', first_pos+1 );
|
||||||
|
if( second_pos == sMask.npos )
|
||||||
{
|
{
|
||||||
size_t second_pos = sMask.find_first_of('*', first_pos+1);
|
/* Only one *: "A*B". */
|
||||||
if( second_pos == sMask.npos )
|
/* XXX: "_blank.png*.png" shouldn't match the file "_blank.png". */
|
||||||
{
|
GetFilesMatching( sDir, sMask.substr(0, first_pos), "", sMask.substr(first_pos+1), asOut, bOnlyDirs );
|
||||||
/* Only one *: "A*B". */
|
return;
|
||||||
/* XXX: "_blank.png*.png" shouldn't match the file "_blank.png". */
|
|
||||||
GetFilesMatching( sDir, sMask.substr(0, first_pos), "", sMask.substr(first_pos+1), asOut, bOnlyDirs );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Two *s: "A*B*C". */
|
|
||||||
GetFilesMatching( sDir,
|
|
||||||
sMask.substr(0, first_pos),
|
|
||||||
sMask.substr(first_pos+1, second_pos-first_pos-1),
|
|
||||||
sMask.substr(second_pos+1), asOut, bOnlyDirs );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Two *s: "A*B*C". */
|
||||||
|
GetFilesMatching( sDir,
|
||||||
|
sMask.substr(0, first_pos),
|
||||||
|
sMask.substr(first_pos+1, second_pos-first_pos-1),
|
||||||
|
sMask.substr(second_pos+1), asOut, bOnlyDirs );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user