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:
@@ -369,10 +369,20 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
|
|||||||
// can also add an existing file directly, it will be copied
|
// can also add an existing file directly, it will be copied
|
||||||
// automatically
|
// automatically
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
report->AddFile(wxT("c:\\autoexec.bat"), wxT("DOS startup file"));
|
wxString windir;
|
||||||
#else
|
if ( !wxGetEnv("WINDIR", &windir) )
|
||||||
report->AddFile(wxT("/etc/motd"), wxT("Message of the day"));
|
windir = "C:\\Windows";
|
||||||
#endif
|
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
|
// calling Show() is not mandatory, but is more polite
|
||||||
if ( wxDebugReportPreviewStd().Show(*report) )
|
if ( wxDebugReportPreviewStd().Show(*report) )
|
||||||
|
Reference in New Issue
Block a user