]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Make FS_mkdir static, and test for errors.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 7 Feb 2015 21:14:40 +0000 (21:14 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 7 Feb 2015 21:14:40 +0000 (21:14 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12152 d7cf8633-e32d-0410-b094-e92efae38249

fs.c
fs.h

diff --git a/fs.c b/fs.c
index 27381f07cc6bbf2a1ca40da9ab354e737d70934a..e961cd1b5ef3d9fbcb32db0cb267f9de38e5e961 100644 (file)
--- 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 cd1979a2939bb424550931e285cc1d1c8ed69200..657f6440a5a721a16bb03d868e4cdec1b1c911a2 100644 (file)
--- 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);