mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 13:01:41 +00:00
Use CMsgBoxDisplayer on non-windows platforms as well.
This commit is contained in:
parent
7394873799
commit
f7db38c7e1
3 changed files with 47 additions and 38 deletions
|
@ -1197,10 +1197,10 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
if (TrapCrashInDebugger || !IsDebuggerPresent ())
|
if (TrapCrashInDebugger || !IsDebuggerPresent ())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
DefaultMsgBoxDisplayer = new CMsgBoxDisplayer ("DEFAULT_MBD");
|
DefaultMsgBoxDisplayer = new CMsgBoxDisplayer ("DEFAULT_MBD");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LOG_IN_FILE
|
#if LOG_IN_FILE
|
||||||
if (logInFile)
|
if (logInFile)
|
||||||
|
|
|
@ -529,7 +529,7 @@ void CFileDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mes
|
||||||
// in release "<Msg>"
|
// in release "<Msg>"
|
||||||
void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *message)
|
void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *message)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
//#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
bool needSpace = false;
|
bool needSpace = false;
|
||||||
// stringstream ss;
|
// stringstream ss;
|
||||||
|
@ -720,7 +720,7 @@ void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *m
|
||||||
}
|
}
|
||||||
*/ }
|
*/ }
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,19 +63,61 @@ void setReportEmailFunction (void *emailFunction)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string Body;
|
||||||
|
static std::string URL = "FILL_IN_CRASH_REPORT_HOSTNAME_HERE";
|
||||||
|
|
||||||
|
|
||||||
|
static void doSendReport()
|
||||||
|
{
|
||||||
|
std::string filename;
|
||||||
|
|
||||||
|
filename = "report_";
|
||||||
|
filename += NLMISC::toString( int( time( NULL ) ) );
|
||||||
|
filename += ".txt";
|
||||||
|
|
||||||
|
std::string params;
|
||||||
|
params = "-log ";
|
||||||
|
params += filename;
|
||||||
|
params += " -host ";
|
||||||
|
params += URL;
|
||||||
|
|
||||||
|
std::ofstream f;
|
||||||
|
f.open( filename.c_str() );
|
||||||
|
if( !f.good() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
f << Body;
|
||||||
|
|
||||||
|
f.close();
|
||||||
|
|
||||||
|
#ifdef NL_OS_WINDOWS
|
||||||
|
NLMISC::launchProgram( "crash_report.exe", params );
|
||||||
|
#else
|
||||||
|
NLMISC::launchProgram( "crash_report", params );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Added because NLSMIC::launcProgram needs time to launch
|
||||||
|
nlSleep( 2 * 1000 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NL_OS_WINDOWS
|
#ifndef NL_OS_WINDOWS
|
||||||
|
|
||||||
// GNU/Linux, do nothing
|
// GNU/Linux, do nothing
|
||||||
|
|
||||||
void report ()
|
TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile)
|
||||||
{
|
{
|
||||||
|
Body = addSlashR( body );
|
||||||
|
|
||||||
|
doSendReport();
|
||||||
|
|
||||||
|
return ReportQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Windows specific version
|
// Windows specific version
|
||||||
|
|
||||||
static string Body;
|
|
||||||
static string Subject;
|
static string Subject;
|
||||||
static string AttachedFile;
|
static string AttachedFile;
|
||||||
|
|
||||||
|
@ -92,39 +134,6 @@ static bool CanSendMailReport= false;
|
||||||
|
|
||||||
static bool DebugDefaultBehavior, QuitDefaultBehavior;
|
static bool DebugDefaultBehavior, QuitDefaultBehavior;
|
||||||
|
|
||||||
static std::string URL = "FILL_IN_CRASH_REPORT_HOSTNAME_HERE";
|
|
||||||
|
|
||||||
static void doSendReport()
|
|
||||||
{
|
|
||||||
std::string filename;
|
|
||||||
|
|
||||||
filename = "report_";
|
|
||||||
filename += NLMISC::toString( time( NULL ) );
|
|
||||||
filename += ".txt";
|
|
||||||
|
|
||||||
std::string params;
|
|
||||||
params = "-log ";
|
|
||||||
params += filename;
|
|
||||||
params += " -host ";
|
|
||||||
params += URL;
|
|
||||||
|
|
||||||
std::ofstream f;
|
|
||||||
f.open( filename.c_str() );
|
|
||||||
if( !f.good() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
f << Body;
|
|
||||||
|
|
||||||
f.close();
|
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
|
||||||
NLMISC::launchProgram( "crash_report.exe", params );
|
|
||||||
#else
|
|
||||||
NLMISC::launchProgram( "crash_report", params );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sendEmail()
|
static void sendEmail()
|
||||||
{
|
{
|
||||||
if (CanSendMailReport && SendMessage(sendReport, BM_GETCHECK, 0, 0) != BST_CHECKED)
|
if (CanSendMailReport && SendMessage(sendReport, BM_GETCHECK, 0, 0) != BST_CHECKED)
|
||||||
|
|
Loading…
Reference in a new issue