Merge with develop

This commit is contained in:
kervala 2015-12-28 18:21:56 +01:00
parent de1519f50b
commit 965971a86d
3 changed files with 24 additions and 21 deletions

View file

@ -80,12 +80,8 @@ TReportResult report(const std::string &title, const std::string &subject, const
std::string reportPath; std::string reportPath;
if (!body.empty()) if (!body.empty())
{ {
std::stringstream reportFile; std::string reportFile = getLogDirectory() + NLMISC::toString("nel_report_%u.log", (uint)time(NULL));
reportFile << getLogDirectory(); reportPath = CFile::findNewFile(reportFile);
reportFile << "nel_report_";
reportFile << (int)time(NULL);
reportFile << ".log";
reportPath = CFile::findNewFile(reportFile.str());
std::ofstream f; std::ofstream f;
f.open(reportPath.c_str()); f.open(reportPath.c_str());
if (!f.good()) if (!f.good())
@ -108,36 +104,34 @@ TReportResult report(const std::string &title, const std::string &subject, const
|| CSystemUtils::detectWindowedApplication()) || CSystemUtils::detectWindowedApplication())
&& CFile::isExists(NL_CRASH_REPORT_TOOL)) && CFile::isExists(NL_CRASH_REPORT_TOOL))
{ {
std::stringstream params; std::string params;
params << NL_CRASH_REPORT_TOOL; params += NL_CRASH_REPORT_TOOL;
if (!reportPath.empty()) if (!reportPath.empty())
params << " -log \"" << reportPath << "\""; params += NLMISC::toString(" -log \"%s\"", reportPath.c_str());
if (!subject.empty()) if (!subject.empty())
params << " -attachment \"" << attachment << "\""; params += NLMISC::toString(" -attachment \"%s\"", attachment.c_str());
if (!title.empty()) if (!title.empty())
params << " -title \"" << title << "\""; params += NLMISC::toString(" -title \"%s\"", title.c_str());
if (!subject.empty()) if (!subject.empty())
params << " -subject \"" << subject << "\""; params += NLMISC::toString(" -subject \"%s\"", subject.c_str());
const char *reportPostUrl = getReportPostURL(); const char *reportPostUrl = getReportPostURL();
if (reportPostUrl) if (reportPostUrl)
params << " -host \"" << reportPostUrl << "\""; params += NLMISC::toString(" -host \"%s\"", reportPostUrl);
if (synchronous) if (synchronous)
params << " -dev"; params += " -dev";
if (sendReport) if (sendReport)
params << " -sendreport"; params += " -sendreport";
std::string paramsStr = params.str();
if (synchronous) if (synchronous)
{ {
TReportResult result = (TReportResult)::system(paramsStr.c_str()); TReportResult result = (TReportResult)::system(params.c_str());
if (result != ReportAlwaysIgnore if (result != ReportAlwaysIgnore
&& result != ReportIgnore && result != ReportIgnore
&& result != ReportAbort && result != ReportAbort
@ -153,7 +147,7 @@ TReportResult report(const std::string &title, const std::string &subject, const
} }
else else
{ {
NLMISC::launchProgram(NL_CRASH_REPORT_TOOL, paramsStr, NLMISC::launchProgram(NL_CRASH_REPORT_TOOL, params,
NL_DEBUG_REPORT ? INelContext::isContextInitialised() : false); // Only log if required, avoid infinite loop NL_DEBUG_REPORT ? INelContext::isContextInitialised() : false); // Only log if required, avoid infinite loop
return defaultResult; return defaultResult;
} }

View file

@ -14,4 +14,9 @@ NL_ADD_RUNTIME_FLAGS(zviewer)
INSTALL(TARGETS zviewer RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) INSTALL(TARGETS zviewer RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
INSTALL(FILES zviewer.cfg DESTINATION ${NL_ETC_PREFIX} COMPONENT tools3d) INSTALL(FILES zviewer.cfg DESTINATION ${NL_ETC_PREFIX} COMPONENT tools3d)
IF(WITH_UNIX_STRUCTURE)
INSTALL(FILES readme.txt DESTINATION ${NL_SHARE_PREFIX}/zviewer COMPONENT tools3d) INSTALL(FILES readme.txt DESTINATION ${NL_SHARE_PREFIX}/zviewer COMPONENT tools3d)
ELSE()
INSTALL(FILES readme.txt DESTINATION ${NL_SHARE_PREFIX} COMPONENT tools3d RENAME zviewer.txt)
ENDIF()

View file

@ -371,7 +371,8 @@ int main(int argc, char **argv)
DisableNLDebug = true; DisableNLDebug = true;
#endif #endif
createDebug(); // don't create log.log anymore because client.log is used
createDebug(NULL, false);
INelContext::getInstance().setWindowedApplication(true); INelContext::getInstance().setWindowedApplication(true);
@ -544,6 +545,9 @@ int main(int argc, char **argv)
strcpy(filename, argv[0]); strcpy(filename, argv[0]);
// set process name for logs
CLog::setProcessName(filename);
// ignore signal SIGPIPE generated by libwww // ignore signal SIGPIPE generated by libwww
signal(SIGPIPE, sigHandler); signal(SIGPIPE, sigHandler);