Don't search for redirs separately; doubling the number of GetDirListing
calls is expensive.
This commit is contained in:
@@ -377,31 +377,24 @@ try_element_again:
|
|||||||
}
|
}
|
||||||
else // look for all files starting with sFileName that have types we can use
|
else // look for all files starting with sFileName that have types we can use
|
||||||
{
|
{
|
||||||
/* First, look for redirs. */
|
|
||||||
GetDirListing( sThemeDir + sCategory + "/" + ClassAndElementToFileName(sClassName,sElement) + "*.redir",
|
|
||||||
asElementPaths, false, true );
|
|
||||||
|
|
||||||
CStringArray asPaths;
|
CStringArray asPaths;
|
||||||
GetDirListing( sThemeDir + sCategory + "/" + ClassAndElementToFileName(sClassName,sElement) + "*",
|
GetDirListing( sThemeDir + sCategory + "/" + ClassAndElementToFileName(sClassName,sElement) + "*",
|
||||||
asPaths, false, true );
|
asPaths, false, true );
|
||||||
|
|
||||||
for( unsigned p = 0; p < asPaths.size(); ++p )
|
for( unsigned p = 0; p < asPaths.size(); ++p )
|
||||||
{
|
{
|
||||||
static const char *masks[NUM_ElementCategory][13] = {
|
static const char *masks[NUM_ElementCategory][14] = {
|
||||||
{ "", "actor", "xml", NULL },
|
{ "redir", "", "actor", "xml", NULL },
|
||||||
{ "ini", NULL },
|
{ "redir", "ini", NULL },
|
||||||
{ "xml", "actor", "sprite", "png", "jpg", "bmp", "gif","avi", "mpg", "mpeg", "txt", "", NULL},
|
{ "redir", "xml", "actor", "sprite", "png", "jpg", "bmp", "gif","avi", "mpg", "mpeg", "txt", "", NULL},
|
||||||
{ "png", NULL },
|
{ "redir", "png", NULL },
|
||||||
{ "mp3", "ogg", "wav", NULL },
|
{ "redir", "mp3", "ogg", "wav", NULL },
|
||||||
{ "*", NULL },
|
{ "*", NULL },
|
||||||
};
|
};
|
||||||
const char **asset_masks = masks[category];
|
const char **asset_masks = masks[category];
|
||||||
|
|
||||||
const CString ext = GetExtension( asPaths[p] );
|
const CString ext = GetExtension( asPaths[p] );
|
||||||
|
|
||||||
if( ext == "redir" )
|
|
||||||
continue; // got it already
|
|
||||||
|
|
||||||
for( int i = 0; asset_masks[i]; ++i )
|
for( int i = 0; asset_masks[i]; ++i )
|
||||||
{
|
{
|
||||||
/* No extension means directories. */
|
/* No extension means directories. */
|
||||||
|
|||||||
Reference in New Issue
Block a user