write the entire file at once in Flush() instead of doing it line by line (patch 1656509)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1047,15 +1047,17 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write all strings to file
|
// write all strings to file
|
||||||
|
wxString filetext;
|
||||||
|
filetext.reserve(4096);
|
||||||
for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() )
|
for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() )
|
||||||
{
|
{
|
||||||
wxString line = p->Text();
|
filetext << p->Text() << wxTextFile::GetEOL();
|
||||||
line += wxTextFile::GetEOL();
|
}
|
||||||
if ( !file.Write(line, *m_conv) )
|
|
||||||
{
|
if ( !file.Write(filetext, *m_conv) )
|
||||||
wxLogError(_("can't write user configuration file."));
|
{
|
||||||
return false;
|
wxLogError(_("can't write user configuration file."));
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !file.Commit() )
|
if ( !file.Commit() )
|
||||||
|
Reference in New Issue
Block a user