From 1bf9c71865b9a6e7f8a4c609fb3775333fdae5be Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 11 Jan 2025 23:11:11 -0600 Subject: [PATCH] get_ and set_ string prefs windows/linux --- src/tools/prefs.win.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tools/prefs.win.cpp b/src/tools/prefs.win.cpp index cb676522..7f350532 100644 --- a/src/tools/prefs.win.cpp +++ b/src/tools/prefs.win.cpp @@ -66,6 +66,17 @@ std::vector get_iarray_pref(std::string keypath) { 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(prefs[keypath]); + return fallback; +} + void clear_pref(std::string keypath) { prefsDirty = true; auto iter = prefs.find(keypath);