diff options
Diffstat (limited to 'code/sys/sys_unix.c')
-rw-r--r-- | code/sys/sys_unix.c | 38 |
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 ); +} |