Browse Source

filesystem: try to fix case of library filename in FindLibrary

pull/2/head
Alibek Omarov 1 year ago
parent
commit
1bfc6e6705
  1. 18
      filesystem/filesystem.c

18
filesystem/filesystem.c

@ -1261,6 +1261,7 @@ search for library, assume index is valid @@ -1261,6 +1261,7 @@ search for library, assume index is valid
*/
static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dllinfo_t *dllInfo )
{
string fixedname;
searchpath_t *search;
int index, start = 0, i, len;
@ -1276,7 +1277,6 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll @@ -1276,7 +1277,6 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll
// replace all backward slashes
len = Q_strlen( dllname );
for( i = 0; i < len; i++ )
{
if( dllname[i+start] == '\\' ) dllInfo->shortPath[i] = '/';
@ -1286,16 +1286,22 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll @@ -1286,16 +1286,22 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll
COM_DefaultExtension( dllInfo->shortPath, "."OS_LIB_EXT, sizeof( dllInfo->shortPath )); // apply ext if forget
search = FS_FindFile( dllInfo->shortPath, &index, NULL, 0, false );
search = FS_FindFile( dllInfo->shortPath, &index, fixedname, sizeof( fixedname ), false );
if( !search && !directpath )
if( search )
{
Q_strncpy( dllInfo->shortPath, fixedname, sizeof( dllInfo->shortPath ));
}
else if( !directpath )
{
fs_ext_path = false;
// trying check also 'bin' folder for indirect paths
Q_strncpy( dllInfo->shortPath, dllname, sizeof( dllInfo->shortPath ));
search = FS_FindFile( dllInfo->shortPath, &index, NULL, 0, false );
if( !search ) return false; // unable to find
search = FS_FindFile( dllname, &index, fixedname, sizeof( fixedname ), false );
if( !search )
return false; // unable to find
Q_strncpy( dllInfo->shortPath, fixedname, sizeof( dllInfo->shortPath ));
}
dllInfo->encrypted = FS_CheckForCrypt( dllInfo->shortPath );

Loading…
Cancel
Save