From 674bcdfeecb7ac7a850efa5ee90456502eb14eae Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 11 Apr 2020 00:00:21 +1000 Subject: [PATCH] INISettingsInterface: Add Save() method --- src/frontend-common/ini_settings_interface.cpp | 15 ++++++++++----- src/frontend-common/ini_settings_interface.h | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/frontend-common/ini_settings_interface.cpp b/src/frontend-common/ini_settings_interface.cpp index 053239bf8..24f7a14bf 100644 --- a/src/frontend-common/ini_settings_interface.cpp +++ b/src/frontend-common/ini_settings_interface.cpp @@ -13,11 +13,16 @@ INISettingsInterface::INISettingsInterface(std::string filename) : m_filename(st INISettingsInterface::~INISettingsInterface() { if (m_dirty) - { - SI_Error err = m_ini.SaveFile(m_filename.c_str(), false); - if (err != SI_OK) - Log_WarningPrintf("Failed to save settings to '%s'.", m_filename.c_str()); - } + Save(); +} + +void INISettingsInterface::Save() +{ + SI_Error err = m_ini.SaveFile(m_filename.c_str(), false); + if (err != SI_OK) + Log_WarningPrintf("Failed to save settings to '%s'.", m_filename.c_str()); + else + m_dirty = false; } void INISettingsInterface::Clear() diff --git a/src/frontend-common/ini_settings_interface.h b/src/frontend-common/ini_settings_interface.h index a1cfe1fda..88dac946f 100644 --- a/src/frontend-common/ini_settings_interface.h +++ b/src/frontend-common/ini_settings_interface.h @@ -9,6 +9,8 @@ public: INISettingsInterface(std::string filename); ~INISettingsInterface(); + void Save(); + void Clear() override; int GetIntValue(const char* section, const char* key, int default_value = 0) override;