aboutsummaryrefslogtreecommitdiffstats
path: root/code/sys/sys_unix.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-11-30 18:32:52 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-11-30 18:32:52 +0000
commit7fccfcafc99fe8a81bee1e2cc32e3e383d238dc2 (patch)
tree7937e9a76c67be3539dd3d156c0504d5a8b14612 /code/sys/sys_unix.c
parent9fd7f3aaf029d18a4e596672f8ec899add5e9a58 (diff)
downloadioquake3-aero-7fccfcafc99fe8a81bee1e2cc32e3e383d238dc2.tar.gz
ioquake3-aero-7fccfcafc99fe8a81bee1e2cc32e3e383d238dc2.zip
* 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
Diffstat (limited to 'code/sys/sys_unix.c')
-rw-r--r--code/sys/sys_unix.c38
1 files changed, 35 insertions, 3 deletions
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 <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
@@ -30,9 +35,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <pwd.h>
#include <libgen.h>
-#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 );
+}