#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,
}
#if wxUSE_CONFIG
-void wxDocManager::FileHistoryLoad(wxConfigBase& config)
+void wxDocManager::FileHistoryLoad(const wxConfigBase& config)
{
if (m_fileHistory)
m_fileHistory->Load(config);
}
#if wxUSE_CONFIG
-void wxFileHistory::Load(wxConfigBase& config)
+void wxFileHistory::Load(const wxConfigBase& config)
{
m_fileHistory.Clear();
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;
}