Skip to content

Commit

Permalink
filesystem: fix regression in FS_LoadFile not skipping leading slashes
Browse files Browse the repository at this point in the history
Earlier it used FS_Open which handles this, but because we don't call
that anymore, just skip it ourselves for compatibility.
  • Loading branch information
a1batross committed Jun 20, 2023
1 parent 4bbd1e5 commit 5a4c443
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion filesystem/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ file_t *FS_Open( const char *filepath, const char *mode, qboolean gamedironly )
if( !fs_searchpaths )
return NULL;

// some stupid mappers used leading '/' or '\' in path to models or sounds
// some mappers used leading '/' or '\' in path to models or sounds
if( filepath[0] == '/' || filepath[0] == '\\' )
filepath++;

Expand Down Expand Up @@ -2337,6 +2337,13 @@ byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamediro
char netpath[MAX_SYSPATH];
int pack_ind;

// some mappers used leading '/' or '\' in path to models or sounds
if( path[0] == '/' || path[0] == '\\' )
path++;

if( path[0] == '/' || path[0] == '\\' )
path++;

if( !fs_searchpaths || FS_CheckNastyPath( path ))
return NULL;

Expand Down

0 comments on commit 5a4c443

Please sign in to comment.