From 5fc5e442f39e37b9672e5c119954bde48228e9fe Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 15 Dec 1998 18:59:30 +0000 Subject: [PATCH] 1. log::save works with wxGTK 2. wxFile::Create() doesn't create files open for reading any more... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/file.cpp | 3 ++- src/common/log.cpp | 9 +++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/common/file.cpp b/src/common/file.cpp index 6cb6e3f059..5458185108 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -174,7 +174,8 @@ bool wxFile::Create(const char *szFileName, bool bOverwrite, int access) { // if bOverwrite we create a new file or truncate the existing one, // otherwise we only create the new file and fail if it already exists - int fd = open(szFileName, O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access); + int fd = open(szFileName, O_WRONLY | O_CREAT | + (bOverwrite ? O_TRUNC : O_EXCL), access); if ( fd == -1 ) { wxLogSysError(_("can't create file '%s'"), szFileName); diff --git a/src/common/log.cpp b/src/common/log.cpp index fd9b103b3d..db45214b9e 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -687,22 +687,19 @@ void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) // retrieve text and save it // ------------------------- -#ifdef __WXGTK__ - // @@@@ TODO: no GetNumberOfLines and GetLineText in wxGTK yet - wxLogError(_("Sorry, this function is not implemented under GTK")); -#else int nLines = m_pTextCtrl->GetNumberOfLines(); for ( int nLine = 0; bOk && nLine < nLines; nLine++ ) { bOk = file.Write(m_pTextCtrl->GetLineText(nLine) + wxTextFile::GetEOL()); } -#endif //GTK if ( bOk ) bOk = file.Close(); if ( !bOk ) { wxLogError(_("Can't save log contents to file.")); - return; + } + else { + wxLogStatus(this, _("Log saved to the file '%s'."), szFileName); } } -- 2.47.2