also check against shader script file name when looking for non-empty shader dir

Greeting Pan
This commit is contained in:
Thomas Debesse 2017-09-02 03:55:52 +02:00
parent 8051dd88ca
commit a9583eb1e6

View file

@ -460,15 +460,21 @@ bool WINAPI QERApp_IsDirContainingShaders( const char *path ){
// they will not be displayed and are not applicable to surfaces // they will not be displayed and are not applicable to surfaces
// exclude shaders from other paths, // exclude shaders from other paths,
// they are not the ones we are looking for // they are not the ones we are looking for
gchar* around = g_strconcat("/", path, ".", NULL);
gchar* prefix = g_strconcat("textures/", path, "/", NULL); gchar* prefix = g_strconcat("textures/", path, "/", NULL);
for ( int i = 0; i < nSize; i++ ) for ( int i = 0; i < nSize; i++ )
{ {
CShader *pShader = reinterpret_cast < CShader * >( g_Shaders[i] ); CShader *pShader = reinterpret_cast < CShader * >( g_Shaders[i] );
if ( g_str_has_prefix( pShader->getName(), prefix ) ) { if ( ( strstr( pShader->getShaderFileName(), around ) != NULL && g_str_has_prefix( pShader->getName(), "textures/" ) ) || g_str_has_prefix( pShader->getName(), prefix ) ) {
g_free(around);
g_free(prefix); g_free(prefix);
return true; return true;
} }
} }
g_free(around);
g_free(prefix); g_free(prefix);
return false; return false;
} }