// description is shown to the user in the report summary
virtual void AddFile(const wxString& name, const wxString& description);
+ // convenience function: write the given text to a file with the given name
+ // and then add it to the report (the difference with AddFile() is that the
+ // file will be created by this function and doesn't have to already exist)
+ bool AddText(const wxString& name,
+ const wxString& text,
+ const wxString& description);
+
#if wxUSE_STACKWALKER
// add an XML file containing the current or exception context and the
// stack trace
m_descriptions.Add(description);
}
+bool
+wxDebugReport::AddText(const wxString& name,
+ const wxString& text,
+ const wxString& description)
+{
+ wxFileName fn(GetDirectory(), name);
+ wxFFile file(fn.GetFullPath(), _T("w"));
+ if ( !file.IsOpened() || !file.Write(text) )
+ return false;
+
+ AddFile(name, description);
+
+ return true;
+}
+
void wxDebugReport::RemoveFile(const wxString& name)
{
const int n = m_files.Index(name);
const wxString notes = m_notes->GetValue();
if ( !notes.empty() )
{
- // for now it's fixed, could make it configurable in the future...
- const wxChar *NOTES_FILE_NAME = _T("notes.txt");
- wxFileName fn(m_dbgrpt.GetDirectory(), NOTES_FILE_NAME);
- wxFFile file(fn.GetFullPath(), _T("w"));
- if ( file.IsOpened() && file.Write(notes) )
- {
- m_dbgrpt.AddFile(NOTES_FILE_NAME, _T("user notes"));
- }
+ // for now filename fixed, could make it configurable in the future...
+ m_dbgrpt.AddText(_T("notes.txt"), notes, _T("user notes"));
}
return true;