git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24187
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
bool wxTextCtrlBase::SaveFile(const wxString& filename)
{
wxString filenameToUse = filename.IsEmpty() ? m_filename : filename;
bool wxTextCtrlBase::SaveFile(const wxString& filename)
{
wxString filenameToUse = filename.IsEmpty() ? m_filename : filename;
+ if ( filenameToUse.empty() )
{
// what kind of message to give? is it an error or a program bug?
wxLogDebug(wxT("Can't save textctrl to file without filename."));
{
// what kind of message to give? is it an error or a program bug?
wxLogDebug(wxT("Can't save textctrl to file without filename."));
- wxFFile file(filename, _T("w"));
+ wxFFile file(filenameToUse, _T("w"));
if ( file.IsOpened() && file.Write(GetValue()) )
{
// it's not modified any longer
DiscardEdits();
if ( file.IsOpened() && file.Write(GetValue()) )
{
// it's not modified any longer
DiscardEdits();
+ // if it worked, save for future calls
+ m_filename = filenameToUse;
wxLogError(_("The text couldn't be saved."));
wxLogError(_("The text couldn't be saved."));