From 34eb258caecef6b5602ff8ceee0c435efd6c15e6 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 4 Jan 2023 22:34:45 +0300 Subject: [PATCH] filesystem: dir: remove PATH_SEPARATOR, fix return value when directory is caseinsensitive --- filesystem/dir.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/filesystem/dir.c b/filesystem/dir.c index 5e073284..550754a5 100644 --- a/filesystem/dir.c +++ b/filesystem/dir.c @@ -287,9 +287,9 @@ 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" )) return false; - for( prev = path, next = Q_strchrnul( prev, PATH_SEPARATOR ); + for( prev = path, next = Q_strchrnul( prev, '/' ); ; - prev = next + 1, next = Q_strchrnul( prev, PATH_SEPARATOR )) + prev = next + 1, next = Q_strchrnul( prev, '/' )) { qboolean uptodate = false; // do not run second scan if we're just updated our directory list size_t temp; @@ -309,9 +309,8 @@ 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; + // check file existense + return createpath ? true : FS_SysFileOrFolderExists( dst ); } // get our entry name @@ -349,10 +348,10 @@ qboolean FS_FixFileCase( dir_t *dir, const char *path, char *dst, const size_t l i = temp; // end of string, found file, return - if( next[0] == '\0' || ( next[0] == PATH_SEPARATOR && next[1] == '\0' )) + if( next[0] == '\0' || ( next[0] == '/' && next[1] == '\0' )) break; - if( !FS_AppendToPath( dst, &i, len, PATH_SEPARATOR_STR, path, "path separator" )) + if( !FS_AppendToPath( dst, &i, len, "/", path, "path separator" )) return false; }