mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-16 06:18:43 +00:00
Changed: Don't need to use std::stringstream
This commit is contained in:
parent
c4ee655889
commit
b9d62139c1
1 changed files with 13 additions and 19 deletions
|
@ -80,12 +80,8 @@ TReportResult report(const std::string &title, const std::string &subject, const
|
|||
std::string reportPath;
|
||||
if (!body.empty())
|
||||
{
|
||||
std::stringstream reportFile;
|
||||
reportFile << getLogDirectory();
|
||||
reportFile << "nel_report_";
|
||||
reportFile << (int)time(NULL);
|
||||
reportFile << ".log";
|
||||
reportPath = CFile::findNewFile(reportFile.str());
|
||||
std::string reportFile = getLogDirectory() + NLMISC::toString("nel_report_%u.log", (uint)time(NULL));
|
||||
reportPath = CFile::findNewFile(reportFile);
|
||||
std::ofstream f;
|
||||
f.open(reportPath.c_str());
|
||||
if (!f.good())
|
||||
|
@ -108,36 +104,34 @@ TReportResult report(const std::string &title, const std::string &subject, const
|
|||
|| CSystemUtils::detectWindowedApplication())
|
||||
&& CFile::isExists(NL_CRASH_REPORT_TOOL))
|
||||
{
|
||||
std::stringstream params;
|
||||
params << NL_CRASH_REPORT_TOOL;
|
||||
std::string params;
|
||||
params += NL_CRASH_REPORT_TOOL;
|
||||
|
||||
if (!reportPath.empty())
|
||||
params << " -log \"" << reportPath << "\"";
|
||||
params += NLMISC::toString(" -log \"%s\"", reportPath.c_str());
|
||||
|
||||
if (!subject.empty())
|
||||
params << " -attachment \"" << attachment << "\"";
|
||||
params += NLMISC::toString(" -attachment \"%s\"", attachment.c_str());
|
||||
|
||||
if (!title.empty())
|
||||
params << " -title \"" << title << "\"";
|
||||
params += NLMISC::toString(" -title \"%s\"", title.c_str());
|
||||
|
||||
if (!subject.empty())
|
||||
params << " -subject \"" << subject << "\"";
|
||||
params += NLMISC::toString(" -subject \"%s\"", subject.c_str());
|
||||
|
||||
const char *reportPostUrl = getReportPostURL();
|
||||
if (reportPostUrl)
|
||||
params << " -host \"" << reportPostUrl << "\"";
|
||||
params += NLMISC::toString(" -host \"%s\"", reportPostUrl);
|
||||
|
||||
if (synchronous)
|
||||
params << " -dev";
|
||||
params += " -dev";
|
||||
|
||||
if (sendReport)
|
||||
params << " -sendreport";
|
||||
|
||||
std::string paramsStr = params.str();
|
||||
params += " -sendreport";
|
||||
|
||||
if (synchronous)
|
||||
{
|
||||
TReportResult result = (TReportResult)::system(paramsStr.c_str());
|
||||
TReportResult result = (TReportResult)::system(params.c_str());
|
||||
if (result != ReportAlwaysIgnore
|
||||
&& result != ReportIgnore
|
||||
&& result != ReportAbort
|
||||
|
@ -153,7 +147,7 @@ TReportResult report(const std::string &title, const std::string &subject, const
|
|||
}
|
||||
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
|
||||
return defaultResult;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue