From 64dcc269136ad1ad47c6df4d707c9a42961c5694 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 16 Oct 2003 09:05:54 +0000 Subject: [PATCH] use correct fallback file name in SaveFile() (patch 820884) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/textcmn.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/textcmn.cpp b/src/common/textcmn.cpp index 119ffc8c01..cf77965c5b 100644 --- a/src/common/textcmn.cpp +++ b/src/common/textcmn.cpp @@ -230,7 +230,7 @@ bool wxTextCtrlBase::LoadFile(const wxString& filename) bool wxTextCtrlBase::SaveFile(const wxString& filename) { wxString filenameToUse = filename.IsEmpty() ? m_filename : filename; - if ( !filenameToUse ) + 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.")); @@ -239,19 +239,20 @@ bool wxTextCtrlBase::SaveFile(const wxString& filename) } #if wxUSE_FFILE - wxFFile file(filename, _T("w")); + wxFFile file(filenameToUse, _T("w")); if ( file.IsOpened() && file.Write(GetValue()) ) { // it's not modified any longer DiscardEdits(); - m_filename = filename; + // if it worked, save for future calls + m_filename = filenameToUse; return TRUE; } +#endif // wxUSE_FFILE wxLogError(_("The text couldn't be saved.")); -#endif // wxUSE_FFILE return FALSE; } -- 2.45.2