mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-03-11 05:21:07 +00:00
filesystem: fill searchpath DIR functions only if file was found in direct path
This commit is contained in:
parent
9381a40506
commit
eb36fe0155
@ -1802,7 +1802,6 @@ and the file index in the package if relevant
|
|||||||
searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedironly )
|
searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedironly )
|
||||||
{
|
{
|
||||||
searchpath_t *search;
|
searchpath_t *search;
|
||||||
char *pEnvPath;
|
|
||||||
|
|
||||||
// search through the path, one element at a time
|
// search through the path, one element at a time
|
||||||
for( search = fs_searchpaths; search; search = search->next )
|
for( search = fs_searchpaths; search; search = search->next )
|
||||||
@ -1828,6 +1827,13 @@ searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedironly )
|
|||||||
search = &fs_directpath;
|
search = &fs_directpath;
|
||||||
memset( search, 0, sizeof( searchpath_t ));
|
memset( search, 0, sizeof( searchpath_t ));
|
||||||
|
|
||||||
|
// root folder has a more priority than netpath
|
||||||
|
Q_strncpy( search->filename, fs_rootdir, sizeof( search->filename ));
|
||||||
|
Q_strcat( search->filename, PATH_SPLITTER );
|
||||||
|
Q_snprintf( netpath, sizeof( netpath ), "%s%s", search->filename, name );
|
||||||
|
|
||||||
|
if( FS_SysFileExists( netpath, true ))
|
||||||
|
{
|
||||||
search->printinfo = FS_PrintInfo_DIR;
|
search->printinfo = FS_PrintInfo_DIR;
|
||||||
search->close = FS_Close_DIR;
|
search->close = FS_Close_DIR;
|
||||||
search->openfile = FS_OpenFile_DIR;
|
search->openfile = FS_OpenFile_DIR;
|
||||||
@ -1835,13 +1841,6 @@ searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedironly )
|
|||||||
search->findfile = FS_FindFile_DIR;
|
search->findfile = FS_FindFile_DIR;
|
||||||
search->search = FS_Search_DIR;
|
search->search = FS_Search_DIR;
|
||||||
|
|
||||||
// root folder has a more priority than netpath
|
|
||||||
Q_strncpy( search->filename, fs_rootdir, sizeof( search->filename ));
|
|
||||||
Q_strcat( search->filename, PATH_SPLITTER );
|
|
||||||
Q_snprintf( netpath, MAX_SYSPATH, "%s%s", search->filename, name );
|
|
||||||
|
|
||||||
if( FS_SysFileExists( netpath, !( search->flags & FS_CUSTOM_PATH ) ))
|
|
||||||
{
|
|
||||||
if( index != NULL )
|
if( index != NULL )
|
||||||
*index = -1;
|
*index = -1;
|
||||||
return search;
|
return search;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user