Use the hosts file in debugrpt sample under all systems.

Attach the hosts file under all platforms to the debug report: this makes more
sense the hosts file could be potentially useful, unlike autoexec.bat and
/etc/motd that were used before, is also consistent between the platforms and,
finally, avoids the error due to autoexec.bat not existing any more in the
modern Windows versions.

Closes #16655.
This commit is contained in:
Vadim Zeitlin 2015-06-18 23:22:13 +02:00
parent 28ba8ed84e
commit 03915200af

View File

@ -369,10 +369,20 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
// can also add an existing file directly, it will be copied
// automatically
#ifdef __WXMSW__
report->AddFile(wxT("c:\\autoexec.bat"), wxT("DOS startup file"));
#else
report->AddFile(wxT("/etc/motd"), wxT("Message of the day"));
#endif
wxString windir;
if ( !wxGetEnv("WINDIR", &windir) )
windir = "C:\\Windows";
fn.AssignDir(windir);
fn.AppendDir("system32");
fn.AppendDir("drivers");
fn.AppendDir("etc");
#else // !__WXMSW__
fn.AssignDir("/etc");
#endif // __WXMSW__/!__WXMSW__
fn.SetFullName("hosts");
if ( fn.FileExists() )
report->AddFile(fn.GetFullPath(), "Local hosts file");
// calling Show() is not mandatory, but is more polite
if ( wxDebugReportPreviewStd().Show(*report) )