add config version

This commit is contained in:
PancakeTAS 2025-07-18 15:30:08 +02:00 committed by Pancake
parent ecd8b4c217
commit a7306ed64a
2 changed files with 5 additions and 1 deletions

View file

@ -2,7 +2,7 @@
#include <string>
const std::string DEFAULT_CONFIG = R"(
const std::string DEFAULT_CONFIG = R"(version = 1
[global]
# override the location of Lossless Scaling
# dll = "/games/Lossless Scaling"

View file

@ -204,6 +204,10 @@ void Config::updateConfig(const std::string& file) {
std::optional<toml::value> parsed;
try {
parsed.emplace(toml::parse(file));
if (!parsed->contains("version"))
throw std::runtime_error("Configuration file is missing 'version' field");
if (parsed->at("version").as_integer() != 1)
throw std::runtime_error("Configuration file version is not supported, expected 1");
} catch (const std::exception& e) {
throw LSFG::rethrowable_error("Unable to parse configuration file", e);
}