]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
command line option -readonly to turn off all writing
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index e21a58395b99b6c775903f96bdda2ce20e5f8234..6e45cd81ac4cb5704cad7af857b63bd7176a6ae0 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -2155,6 +2155,9 @@ int FS_SysOpenFD(const char *filepath, const char *mode, qboolean nonblocking)
        if (nonblocking)
                opt |= O_NONBLOCK;
 
+       if(COM_CheckParm("-readonly") && mod != O_RDONLY)
+               return -1;
+
 #ifdef WIN32
 # if _MSC_VER >= 1400
        _sopen_s(&handle, filepath, mod | opt, (dolock ? ((mod == O_RDONLY) ? _SH_DENYRD : _SH_DENYRW) : _SH_DENYNO), _S_IREAD | _S_IWRITE);
@@ -3372,6 +3375,9 @@ qboolean FS_SysFileExists (const char *path)
 
 void FS_mkdir (const char *path)
 {
+       if(COM_CheckParm("-readonly"))
+               return;
+
 #if WIN32
        _mkdir (path);
 #else