Browse Source

filesystem: dir: fix FS_FixFileCase when empty string is passed. Always append slash to searchpath.

pull/2/head
Alibek Omarov 1 year ago
parent
commit
a6ecc778fc
  1. 12
      filesystem/dir.c

12
filesystem/dir.c

@ -290,6 +290,10 @@ qboolean FS_FixFileCase( dir_t *dir, const char *path, char *dst, const size_t l
if( !FS_AppendToPath( dst, &i, len, dir->name, path, "init" )) if( !FS_AppendToPath( dst, &i, len, dir->name, path, "init" ))
return false; return false;
// nothing to fix
if( !COM_CheckStringEmpty( path ))
return true;
for( prev = path, next = Q_strchrnul( prev, '/' ); for( prev = path, next = Q_strchrnul( prev, '/' );
; ;
prev = next + 1, next = Q_strchrnul( prev, '/' )) prev = next + 1, next = Q_strchrnul( prev, '/' ))
@ -464,8 +468,12 @@ void FS_InitDirectorySearchpath( searchpath_t *search, const char *path, int fla
{ {
memset( search, 0, sizeof( searchpath_t )); memset( search, 0, sizeof( searchpath_t ));
Q_strncpy( search->filename, path, sizeof( search->filename )); Q_strncpy( search->filename, path, sizeof( search->filename ) - 1 );
search->type = SEARCHPATH_PLAIN; COM_PathSlashFix( search->filename );
if( !Q_stricmp( COM_FileExtension( path ), "pk3dir" ))
search->type = SEARCHPATH_PK3DIR;
else search->type = SEARCHPATH_PLAIN;
search->flags = flags; search->flags = flags;
search->pfnPrintInfo = FS_PrintInfo_DIR; search->pfnPrintInfo = FS_PrintInfo_DIR;
search->pfnClose = FS_Close_DIR; search->pfnClose = FS_Close_DIR;

Loading…
Cancel
Save