From 67d8af4a4f0952303e2c259258f9e37943ee8144 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sat, 12 Dec 2020 09:50:52 -0500 Subject: [PATCH] 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 --- common/hotkeys_basic.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index c884e596b2..8e239711cd 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include @@ -375,10 +377,15 @@ int WriteHotKeyConfig( const std::map& 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; }