From 52250695f6b30eb56433727c59ff229d59fce81b Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 22 Feb 2015 18:45:41 +0100 Subject: [PATCH] Launch the error report application instead of sending an email. --- code/nel/src/misc/debug.cpp | 3 ++- code/nel/src/misc/report.cpp | 38 ++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index c7667acc2..3f0c26f69 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -83,7 +83,8 @@ using namespace std; #define LOG_IN_FILE NEL_LOG_IN_FILE // If true, debug system will trap crash even if the application is in debugger -static const bool TrapCrashInDebugger = false; +//static const bool TrapCrashInDebugger = false; +static const bool TrapCrashInDebugger = true; #ifdef DEBUG_NEW #define new DEBUG_NEW diff --git a/code/nel/src/misc/report.cpp b/code/nel/src/misc/report.cpp index 20b2b1c11..d761373fd 100644 --- a/code/nel/src/misc/report.cpp +++ b/code/nel/src/misc/report.cpp @@ -92,6 +92,36 @@ static bool CanSendMailReport= false; static bool DebugDefaultBehavior, QuitDefaultBehavior; +static void doSendReport() +{ + std::string filename; + + // Unfortunately Qt 4.8.5 on Windows messes up arguments. + // As a workaround the report filename is hardcoded for now. + // + //filename = "report_"; + //filename += NLMISC::toString( time( NULL ) ); + //filename += ".txt"; + + filename = "rcerrorlog.txt"; + + std::ofstream f; + f.open( filename.c_str() ); + if( !f.good() ) + return; + + f << Body; + + f.close(); + +#ifdef NL_OS_WINDOWS + NLMISC::launchProgram( "rcerror.exe", filename ); +#else + NLMISC::launchProgram( "rcerror", filename ); +#endif + +} + static void sendEmail() { if (CanSendMailReport && SendMessage(sendReport, BM_GETCHECK, 0, 0) != BST_CHECKED) @@ -133,7 +163,7 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM } else if ((HWND) lParam == debug) { - sendEmail(); + doSendReport(); NeedExit = true; Result = ReportDebug; if (DebugDefaultBehavior) @@ -143,13 +173,13 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM } else if ((HWND) lParam == ignore) { - sendEmail(); + doSendReport(); NeedExit = true; Result = ReportIgnore; } else if ((HWND) lParam == quit) { - sendEmail(); + doSendReport(); NeedExit = true; Result = ReportQuit; @@ -191,7 +221,7 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM if (wParam == 27) { // ESC -> ignore - sendEmail(); + doSendReport(); NeedExit = true; Result = ReportIgnore; }