X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6fe9f9c0090f8bf3e3d4af89aebb7fbaf2a7a95..6c2cd2a2116c5eff1646e0acb7cad2c887300300:/src/common/docview.cpp diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 6c364c1438..fd55bcb89f 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -298,8 +298,12 @@ bool wxDocument::SaveAs() #else wxString filter = docTemplate->GetFileFilter() ; #endif + wxString defaultDir = docTemplate->GetDirectory(); + if (defaultDir.IsEmpty()) + defaultDir = wxPathOnly(GetFilename()); + wxString tmp = wxFileSelector(_("Save As"), - docTemplate->GetDirectory(), + defaultDir, wxFileNameFromPath(GetFilename()), docTemplate->GetDefaultExtension(), filter, @@ -1505,7 +1509,7 @@ void wxDocManager::FileHistoryRemoveMenu(wxMenu *menu) } #if wxUSE_CONFIG -void wxDocManager::FileHistoryLoad(wxConfigBase& config) +void wxDocManager::FileHistoryLoad(const wxConfigBase& config) { if (m_fileHistory) m_fileHistory->Load(config); @@ -2271,7 +2275,7 @@ void wxFileHistory::RemoveMenu(wxMenu *menu) } #if wxUSE_CONFIG -void wxFileHistory::Load(wxConfigBase& config) +void wxFileHistory::Load(const wxConfigBase& config) { m_fileHistory.Clear(); @@ -2435,15 +2439,22 @@ bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename) return false; char buf[4096]; - do + for ( ;; ) { stream.Read(buf, WXSIZEOF(buf)); const size_t nRead = stream.LastRead(); - if ( !nRead || !file.Write(buf, nRead) ) + if ( !nRead ) + { + if ( stream.Eof() ) + break; + + return false; + } + + if ( !file.Write(buf, nRead) ) return false; } - while ( !stream.Eof() ); return true; }