From 2ed9f7d0739f091727dea48ba46a65b103802bd9 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 18 Sep 2012 11:57:22 +0000 Subject: [PATCH 1/1] command line option -readonly to turn off all writing git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11845 d7cf8633-e32d-0410-b094-e92efae38249 --- fs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs.c b/fs.c index e21a5839..6e45cd81 100644 --- 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 -- 2.39.2