2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-22 01:45:19 +01:00

filesystem: dir: guarantee file existense in FS_FixFileCase for caseinsensitive directories

This commit is contained in:
Alibek Omarov 2023-01-04 18:09:00 +03:00
parent cb9605430d
commit e694081626

View File

@ -280,7 +280,8 @@ static inline qboolean FS_AppendToPath( char *dst, size_t *pi, const size_t len,
qboolean FS_FixFileCase( dir_t *dir, const char *path, char *dst, const size_t len, qboolean createpath )
{
const char *prev, *next;
const char *prev;
const char *next;
size_t i = 0;
if( !FS_AppendToPath( dst, &i, len, dir->name, path, "init" ))
@ -307,6 +308,9 @@ qboolean FS_FixFileCase( dir_t *dir, const char *path, char *dst, const size_t l
{
if( !FS_AppendToPath( dst, &i, len, prev, path, "caseinsensitive entry" ))
return false;
if( FS_SysFileOrFolderExists( dst )) // file not found
return createpath;
break;
}
@ -373,7 +377,7 @@ static int FS_FindFile_DIR( searchpath_t *search, const char *path, char *fixedn
if( !FS_FixFileCase( search->dir, path, netpath, sizeof( netpath ), false ))
return -1;
if( FS_SysFileExists( netpath, !FBitSet( search->flags, FS_CUSTOM_PATH )))
if( FS_SysFileExists( netpath ))
{
// return fixed case file name only local for that searchpath
if( fixedname )