From d0127e5e14ea03997a4903fa905de3859bc1c2de Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 14 May 2023 08:21:13 +0300 Subject: [PATCH] filesystem: fix FS_GetDiskPath, it was broken since implementing caseinsensitive emulation, oops Anyway, FS_GetFullDiskPath is a proper safe version that lacks this bug --- filesystem/filesystem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/filesystem/filesystem.c b/filesystem/filesystem.c index 157cd403..070f9efc 100644 --- a/filesystem/filesystem.c +++ b/filesystem/filesystem.c @@ -2417,16 +2417,19 @@ return NULL for file in pack */ const char *FS_GetDiskPath( const char *name, qboolean gamedironly ) { - static char temp[MAX_SYSPATH]; + static char diskpath[MAX_SYSPATH]; + char fullpath[MAX_SYSPATH]; searchpath_t *search; - search = FS_FindFile( name, NULL, temp, sizeof( temp ), gamedironly ); + search = FS_FindFile( name, NULL, fullpath, sizeof( fullpath ), gamedironly ); if( search ) { if( search->type != SEARCHPATH_PLAIN ) // file in pack or wad return NULL; - return temp; + + Q_snprintf( diskpath, sizeof( diskpath ), "%s/%s", search->filename, fullpath ); + return diskpath; } return NULL;