INISettingsInterface: Add Save() method

This commit is contained in:
Connor McLaughlin 2020-04-11 00:00:21 +10:00
parent ebc3aa118c
commit 674bcdfeec
2 changed files with 12 additions and 5 deletions

View File

@ -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()

View File

@ -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;