From 4b13d24fe8e52591f71dacb5861607a7fe5e9be7 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 7 Feb 2015 21:14:40 +0000 Subject: [PATCH] Make FS_mkdir static, and test for errors. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12152 d7cf8633-e32d-0410-b094-e92efae38249 --- fs.c | 31 +++++++++++++++++++------------ fs.h | 2 -- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/fs.c b/fs.c index 27381f07..e961cd1b 100644 --- a/fs.c +++ b/fs.c @@ -893,6 +893,25 @@ static packfile_t* FS_AddFileToPack (const char* name, pack_t* pack, } +static void FS_mkdir (const char *path) +{ + if(COM_CheckParm("-readonly")) + return; + +#if WIN32 + if (_mkdir (path) == -1) +#else + if (mkdir (path, 0777) == -1) +#endif + { + // No logging for this. The only caller is FS_CreatePath (which + // calls it in ways that will intentionally produce EEXIST), + // and its own callers always use the directory afterwards and + // thus will detect failure that way. + } +} + + /* ============ FS_CreatePath @@ -3415,18 +3434,6 @@ qboolean FS_SysFileExists (const char *path) return FS_SysFileType (path) != FS_FILETYPE_NONE; } -void FS_mkdir (const char *path) -{ - if(COM_CheckParm("-readonly")) - return; - -#if WIN32 - _mkdir (path); -#else - mkdir (path, 0777); -#endif -} - /* =========== FS_Search diff --git a/fs.h b/fs.h index cd1979a2..657f6440 100644 --- a/fs.h +++ b/fs.h @@ -129,8 +129,6 @@ int FS_SysFileType (const char *filename); // only look for files outside of pa qboolean FS_FileExists (const char *filename); // the file can be into a package qboolean FS_SysFileExists (const char *filename); // only look for files outside of packages -void FS_mkdir (const char *path); - unsigned char *FS_Deflate(const unsigned char *data, size_t size, size_t *deflated_size, int level, mempool_t *mempool); unsigned char *FS_Inflate(const unsigned char *data, size_t size, size_t *inflated_size, mempool_t *mempool); -- 2.39.2