get_ and set_ string prefs windows/linux

This commit is contained in:
2025-01-11 23:11:11 -06:00
committed by Celtic Minstrel
parent 59de48f25e
commit 1bf9c71865

View File

@@ -66,6 +66,17 @@ std::vector<int> get_iarray_pref(std::string keypath) {
return {}; return {};
} }
void set_pref(std::string keypath, std::string value) {
prefsDirty = true;
prefs[keypath] = value;
}
std::string get_string_pref(std::string keypath, std::string fallback) {
if(prefs.find(keypath) == prefs.end()) return fallback;
if(prefs[keypath].type() == typeid(std::string)) return boost::any_cast<std::string>(prefs[keypath]);
return fallback;
}
void clear_pref(std::string keypath) { void clear_pref(std::string keypath) {
prefsDirty = true; prefsDirty = true;
auto iter = prefs.find(keypath); auto iter = prefs.find(keypath);