mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
fix config related bugs
This commit is contained in:
parent
420fa191d3
commit
218d82f52c
1 changed files with 6 additions and 0 deletions
|
|
@ -193,6 +193,11 @@ void Config::updateConfig(const std::string& file) {
|
||||||
globalConf.valid->store(true, std::memory_order_relaxed);
|
globalConf.valid->store(true, std::memory_order_relaxed);
|
||||||
if (!std::filesystem::exists(file)) {
|
if (!std::filesystem::exists(file)) {
|
||||||
std::cerr << "lsfg-vk: Placing default configuration file at " << file << '\n';
|
std::cerr << "lsfg-vk: Placing default configuration file at " << file << '\n';
|
||||||
|
const auto parent = std::filesystem::path(file).parent_path();
|
||||||
|
if (!std::filesystem::exists(parent))
|
||||||
|
if (!std::filesystem::create_directories(parent))
|
||||||
|
throw std::runtime_error("Unable to create configuration directory at " + parent.string());
|
||||||
|
|
||||||
std::ofstream out(file);
|
std::ofstream out(file);
|
||||||
if (!out.is_open())
|
if (!out.is_open())
|
||||||
throw std::runtime_error("Unable to create configuration file at " + file);
|
throw std::runtime_error("Unable to create configuration file at " + file);
|
||||||
|
|
@ -238,6 +243,7 @@ void Config::updateConfig(const std::string& file) {
|
||||||
const std::string exe = toml::find<std::string>(gameTable, "exe");
|
const std::string exe = toml::find<std::string>(gameTable, "exe");
|
||||||
Configuration game{
|
Configuration game{
|
||||||
.enable = true,
|
.enable = true,
|
||||||
|
.dll = global.dll,
|
||||||
.env = parse_env(toml::find_or(gameTable, "env", std::string())),
|
.env = parse_env(toml::find_or(gameTable, "env", std::string())),
|
||||||
.multiplier = toml::find_or(gameTable, "multiplier", 2U),
|
.multiplier = toml::find_or(gameTable, "multiplier", 2U),
|
||||||
.flowScale = toml::find_or(gameTable, "flow_scale", 1.0F),
|
.flowScale = toml::find_or(gameTable, "flow_scale", 1.0F),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue