0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 05:43:43 +00:00

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
This commit is contained in:
freezarite 2024-12-16 05:47:28 +01:00
parent 5e48f4e34f
commit acdbf29896

View File

@ -3,7 +3,9 @@
#include <fstream>
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<std::string>& path) {
customConfig = path;
if (path.has_value()) {
customConfig = loadConfigFromJSON(path.value());
}
}
json ConfigLoader::mergeConfigs(json baseConfig, json customConfig) {