settings: Add resetSettings() method

Allows the GUI to clear settings.json file and save settings.json.bak file when
GUI "Reset Options" button is pressed or -resetguisettings command line option
is used. (GUI code already backs up and resets the "guisettings.ini" file this
way, so this just makes the same behavior possible for "settings.json")
This commit is contained in:
Ryan Ofsky
2022-05-16 14:37:00 -04:00
parent 77fabffef4
commit f9fdcec7e9
4 changed files with 22 additions and 6 deletions

View File

@@ -440,7 +440,7 @@ protected:
* Get settings file path, or return false if read-write settings were
* disabled with -nosettings.
*/
bool GetSettingsPath(fs::path* filepath = nullptr, bool temp = false) const;
bool GetSettingsPath(fs::path* filepath = nullptr, bool temp = false, bool backup = false) const;
/**
* Read settings file. Push errors to vector, or log them if null.
@@ -448,9 +448,10 @@ protected:
bool ReadSettingsFile(std::vector<std::string>* errors = nullptr);
/**
* Write settings file. Push errors to vector, or log them if null.
* Write settings file or backup settings file. Push errors to vector, or
* log them if null.
*/
bool WriteSettingsFile(std::vector<std::string>* errors = nullptr) const;
bool WriteSettingsFile(std::vector<std::string>* errors = nullptr, bool backup = false) const;
/**
* Get current setting from config file or read/write settings file,