From 7fccfcafc99fe8a81bee1e2cc32e3e383d238dc2 Mon Sep 17 00:00:00 2001 From: tma Date: Fri, 30 Nov 2007 18:32:52 +0000 Subject: * Add con_log.c to log all console output * Add con_passive.c to cut down on #ifdef DEDICATED in sys_main.c * Add Sys_ErrorDialog to report ERR_FATALs to the user + On Windows use a MessageBox and offer to copy the console log to the clipboard + On everything else print to the terminal and save the console log as crashlog.txt git-svn-id: svn://svn.icculus.org/quake3/trunk@1222 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/sys/sys_unix.c | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'code/sys/sys_unix.c') diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index adb3324..9d9d5aa 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -19,6 +19,11 @@ along with Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ + +#include "../qcommon/q_shared.h" +#include "../qcommon/qcommon.h" +#include "sys_local.h" + #include #include #include @@ -30,9 +35,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include -#include "../qcommon/q_shared.h" -#include "../qcommon/qcommon.h" - // Used to determine where to store user-specific files static char homePath[ MAX_OSPATH ] = { 0 }; @@ -476,3 +478,33 @@ void Sys_Sleep( int msec ) select((fileno(stdin) + 1), &fdset, NULL, NULL, &timeout); } } + +/* +============== +Sys_ErrorDialog + +Display an error message +============== +*/ +void Sys_ErrorDialog( const char *error ) +{ + char buffer[ 1024 ]; + unsigned int size; + fileHandle_t f; + const char *fileName = "crashlog.txt"; + + Sys_Print( va( "%s\n", error ) ); + + // Write console log to file + f = FS_FOpenFileWrite( fileName ); + if( !f ) + { + Com_Printf( "ERROR: couldn't open %s\n", fileName ); + return; + } + + while( ( size = CON_LogRead( buffer, sizeof( buffer ) ) ) > 0 ) + FS_Write( buffer, size, f ); + + FS_FCloseFile( f ); +} -- cgit v1.2.3