From 7e574ea42e6dda4298e2f22e1b026b9dd493f38d Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 18 Dec 2021 05:56:38 +0300 Subject: [PATCH] engine: filesystem: do not create folders for files in rodir mode --- engine/common/filesystem.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/engine/common/filesystem.c b/engine/common/filesystem.c index e15c6f1a..8f928d5d 100644 --- a/engine/common/filesystem.c +++ b/engine/common/filesystem.c @@ -2114,9 +2114,15 @@ void FS_Init( void ) for( i = 0; i < dirs.numstrings; i++ ) { - // no need to check folders here, FS_CreatePath will not fail if path exists - // and listdirectory returns only really existing directories - FS_CreatePath( va( "%s" PATH_SPLITTER "%s/", host.rootdir, dirs.strings[i] )); + const char *roPath = va( "%s" PATH_SPLITTER "%s", host.rodir, dirs.strings[i] ); + const char *rwPath = va( "%s" PATH_SPLITTER "%s", host.rootdir, dirs.strings[i] ); + + // check if it's a directory + if( !FS_SysFolderExists( roPath )) + continue; + + // no need to check folders here, FS_CreatePath will not fail + FS_CreatePath( rwPath ); } stringlistfreecontents( &dirs );