Allow multiple configuration files

Will merge contents from
@CMAKE_INSTALL_PREFIX@/share/wivrn/config.json
/etc/wivrn/config.json
~/.config/wivrn.config.json (XDG_CONFIG_DIR in fact)

If -f option is provided, just parse that file, don't merge anything
This commit is contained in:
Patrick Nicolas
2025-07-06 10:22:25 +02:00
parent fbe5430dc2
commit 11cd9235d9
11 changed files with 99 additions and 53 deletions
+5 -2
View File
@@ -23,6 +23,7 @@
#include <chrono>
#include <filesystem>
#include <map>
#include <nlohmann/json.hpp>
#include <optional>
#include <string>
#include <variant>
@@ -68,8 +69,10 @@ struct configuration
std::variant<std::monostate, std::string, std::nullptr_t> openvr_compat_path;
static void set_config_file(const std::filesystem::path &);
static const std::filesystem::path & get_config_file();
static configuration read_user_configuration();
static std::filesystem::path get_config_file();
static nlohmann::json read_configuration();
configuration();
};
std::string server_cookie();