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:
parent
5e48f4e34f
commit
acdbf29896
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user