Browse Source

filesystem: wad: fix loading WADs by absolute paths

pull/2/head
Alibek Omarov 2 years ago
parent
commit
1e8c26a527
  1. 22
      filesystem/wad.c

22
filesystem/wad.c

@ -287,17 +287,33 @@ open the wad for reading & writing
static wfile_t *W_Open( const char *filename, int *error ) static wfile_t *W_Open( const char *filename, int *error )
{ {
wfile_t *wad = (wfile_t *)Mem_Calloc( fs_mempool, sizeof( wfile_t )); wfile_t *wad = (wfile_t *)Mem_Calloc( fs_mempool, sizeof( wfile_t ));
const char *basename;
int i, lumpcount; int i, lumpcount;
dlumpinfo_t *srclumps; dlumpinfo_t *srclumps;
size_t lat_size; size_t lat_size;
dwadinfo_t header; dwadinfo_t header;
// NOTE: FS_Open is load wad file from the first pak in the list (while fs_ext_path is false) // NOTE: FS_Open is load wad file from the first pak in the list (while fs_ext_path is false)
if( fs_ext_path ) basename = filename; if( fs_ext_path )
else basename = COM_FileWithoutPath( filename ); {
int ind;
searchpath_t *search = FS_FindFile( filename, &ind, NULL, 0, false );
// allow direct absolute paths
// TODO: catch them in FS_FindFile_DIR!
if( !search || ind < 0 )
{
wad->handle = FS_SysOpen( filename, "rb" );
}
else
{
wad->handle = search->pfnOpenFile( search, filename, "rb", ind );
}
}
else
{
const char *basename = COM_FileWithoutPath( filename );
wad->handle = FS_Open( basename, "rb", false ); wad->handle = FS_Open( basename, "rb", false );
}
if( wad->handle == NULL ) if( wad->handle == NULL )
{ {

Loading…
Cancel
Save