From 359864866cdaab7fad5ae6b734f4b011e0e75bb3 Mon Sep 17 00:00:00 2001 From: thilo Date: Fri, 21 Apr 2006 17:04:21 +0000 Subject: - botlib logfile now gets stored in the fs_game directory in fs_homepath. (patch from Erik Auerswald) - Added proper error handling when fopening qconsole.log - Fixed bug where r_chat.c gets loaded in botlib even when bot_nochat is 1. git-svn-id: svn://svn.icculus.org/quake3/trunk@715 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/qcommon/common.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'code/qcommon') diff --git a/code/qcommon/common.c b/code/qcommon/common.c index 1c37c5e..5708146 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -181,11 +181,22 @@ void QDECL Com_Printf( const char *fmt, ... ) { newtime = localtime( &aclock ); logfile = FS_FOpenFileWrite( "qconsole.log" ); - Com_Printf( "logfile opened on %s\n", asctime( newtime ) ); - if ( com_logfile->integer > 1 ) { - // force it to not buffer so we get valid - // data even if we are crashing - FS_ForceFlush(logfile); + + if(logfile) + { + Com_Printf( "logfile opened on %s\n", asctime( newtime ) ); + + if ( com_logfile->integer > 1 ) + { + // force it to not buffer so we get valid + // data even if we are crashing + FS_ForceFlush(logfile); + } + } + else + { + Com_Printf("Opening qconsole.log failed!\n"); + Cvar_SetValue("logfile", 0); } opening_qconsole = qfalse; -- cgit v1.2.3