Use buffered file write for hotkeys

Not a important change in the slightest but who knows, it might help someone saving to a network drive
This commit is contained in:
Marek Roszko 2020-12-12 09:50:52 -05:00
parent 807eef1208
commit 67d8af4a4f
1 changed files with 9 additions and 2 deletions

View File

@ -36,6 +36,8 @@
#include <wx/apptrait.h>
#include <wx/stdpaths.h>
#include <wx/tokenzr.h>
#include <wx/txtstrm.h>
#include <wx/wfstream.h>
#include <tool/tool_action.h>
@ -375,10 +377,15 @@ int WriteHotKeyConfig( const std::map<std::string, TOOL_ACTION*>& aActionMap )
// Write entire hotkey set
//
wxFile file( fn.GetFullPath(), wxFile::OpenMode::write );
wxFFileOutputStream outStream( fn.GetFullPath() );
wxTextOutputStream txtStream( outStream, wxEOL_UNIX );
for( const auto& ii : hotkeys )
file.Write( wxString::Format( "%s\t%s\n", ii.first, KeyNameFromKeyCode( ii.second ) ) );
txtStream << wxString::Format( "%s\t%s", ii.first, KeyNameFromKeyCode( ii.second ) ) << endl;
txtStream.Flush();
outStream.Close();
return 1;
}