mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
add config version
This commit is contained in:
parent
ecd8b4c217
commit
a7306ed64a
2 changed files with 5 additions and 1 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
const std::string DEFAULT_CONFIG = R"(
|
const std::string DEFAULT_CONFIG = R"(version = 1
|
||||||
[global]
|
[global]
|
||||||
# override the location of Lossless Scaling
|
# override the location of Lossless Scaling
|
||||||
# dll = "/games/Lossless Scaling"
|
# dll = "/games/Lossless Scaling"
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,10 @@ void Config::updateConfig(const std::string& file) {
|
||||||
std::optional<toml::value> parsed;
|
std::optional<toml::value> parsed;
|
||||||
try {
|
try {
|
||||||
parsed.emplace(toml::parse(file));
|
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) {
|
} catch (const std::exception& e) {
|
||||||
throw LSFG::rethrowable_error("Unable to parse configuration file", e);
|
throw LSFG::rethrowable_error("Unable to parse configuration file", e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue