This commit is contained in:
Jorijn van der Graaf 2025-11-01 11:02:52 +01:00
commit 72effdee9b
3 changed files with 18 additions and 11 deletions

View file

@ -37,6 +37,8 @@ namespace Crafter {
}
void Configuration::SetDataFromJson(const nlohmann::json& configs, const nlohmann::json& config, fs::path workingDir) {
type = static_cast<ConfigurationType>(-1);
debug = static_cast<bool>(2);
if(config.contains("extends")) {
const std::vector<std::string> extends = config["extends"].get<std::vector<std::string>>();
for(const std::string& extendName : extends) {
@ -60,6 +62,8 @@ namespace Crafter {
}
if(config.contains("debug")) {
debug = config["debug"].get<bool>();
} else if(static_cast<int>(debug) == 2) {
debug = false;
}
if(config.contains("type")) {
std::string typeString = config["type"].get<std::string>();
@ -72,6 +76,8 @@ namespace Crafter {
} else {
throw std::invalid_argument("Unknown type: " + typeString);
}
} else if(static_cast<int>(type) == -1) {
type = CRAFTER_CONFIGURATION_TYPE_EXECUTABLE;
}
if(config.contains("march")) {
march = config["march"].get<std::string>();