Browse Source

filesystem: fix strict order of loading archives

pull/2/head
Alibek Omarov 2 years ago
parent
commit
9c0c1a802c
  1. 20
      filesystem/filesystem.c

20
filesystem/filesystem.c

@ -320,7 +320,8 @@ void FS_AddGameDirectory( const char *dir, uint flags )
listdirectory( &list, dir ); listdirectory( &list, dir );
stringlistsort( &list ); stringlistsort( &list );
// add any PAK package in the directory // add archives in specific order PAK -> PK3 -> WAD
// so raw WADs takes precedence over WADs included into PAKs and PK3s
for( i = 0; i < list.numstrings; i++ ) for( i = 0; i < list.numstrings; i++ )
{ {
const char *ext = COM_FileExtension( list.strings[i] ); const char *ext = COM_FileExtension( list.strings[i] );
@ -330,12 +331,24 @@ void FS_AddGameDirectory( const char *dir, uint flags )
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", dir, list.strings[i] ); Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", dir, list.strings[i] );
FS_AddPak_Fullpath( fullpath, NULL, flags ); FS_AddPak_Fullpath( fullpath, NULL, flags );
} }
else if( !Q_stricmp( ext, "pk3" )) }
for( i = 0; i < list.numstrings; i++ )
{
const char *ext = COM_FileExtension( list.strings[i] );
if( !Q_stricmp( ext, "pk3" ))
{ {
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", dir, list.strings[i] ); Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", dir, list.strings[i] );
FS_AddZip_Fullpath( fullpath, NULL, flags ); FS_AddZip_Fullpath( fullpath, NULL, flags );
} }
else if( !Q_stricmp( ext, "wad" )) }
for( i = 0; i < list.numstrings; i++ )
{
const char *ext = COM_FileExtension( list.strings[i] );
if( !Q_stricmp( ext, "wad" ))
{ {
FS_AllowDirectPaths( true ); FS_AllowDirectPaths( true );
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", dir, list.strings[i] ); Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", dir, list.strings[i] );
@ -343,6 +356,7 @@ void FS_AddGameDirectory( const char *dir, uint flags )
FS_AllowDirectPaths( false ); FS_AllowDirectPaths( false );
} }
} }
stringlistfreecontents( &list ); stringlistfreecontents( &list );
// add the directory to the search path // add the directory to the search path

Loading…
Cancel
Save