From acdbf29896de68c3bffeed9b33b32850028f11ef Mon Sep 17 00:00:00 2001 From: freezarite Date: Mon, 16 Dec 2024 05:47:28 +0100 Subject: [PATCH] Fixed a bug where the custom json was not loaded correctly Changed base config location to ./engine/config.json to make implementation better for the game-dev --- src/ConfigLoader.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ConfigLoader.cpp b/src/ConfigLoader.cpp index 4620c56..65381f5 100644 --- a/src/ConfigLoader.cpp +++ b/src/ConfigLoader.cpp @@ -3,7 +3,9 @@ #include ConfigLoader::ConfigLoader() { - baseConfig = loadConfigFromJSON("config.json"); + //TODO: look into adaptive paths for better handling as this requires the implemented game + // to have ./engine in the root folder + baseConfig = loadConfigFromJSON("./engine/config.json"); } ConfigLoader::~ConfigLoader() {} @@ -30,7 +32,9 @@ json ConfigLoader::loadConfigFromJSON(const std::string& path) { void ConfigLoader::setCustomConfig(const std::optional& path) { - customConfig = path; + if (path.has_value()) { + customConfig = loadConfigFromJSON(path.value()); + } } json ConfigLoader::mergeConfigs(json baseConfig, json customConfig) {