fix: dependency level prefix is ignored
This commit is contained in:
parent
3b5857ee62
commit
9b53def82a
@ -4,12 +4,13 @@
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
#include "constants.hpp"
|
||||
#include "coders/json.hpp"
|
||||
#include "constants.hpp"
|
||||
#include "data/dv.hpp"
|
||||
#include "files/engine_paths.hpp"
|
||||
#include "files/files.hpp"
|
||||
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
ContentPack ContentPack::createCore(const EnginePaths* paths) {
|
||||
@ -78,13 +79,26 @@ ContentPack ContentPack::read(const fs::path& folder) {
|
||||
root.at("creator").get(pack.creator);
|
||||
root.at("description").get(pack.description);
|
||||
pack.folder = folder;
|
||||
|
||||
|
||||
if (auto found = root.at("dependencies")) {
|
||||
const auto& dependencies = *found;
|
||||
for (const auto& elem : dependencies) {
|
||||
pack.dependencies.push_back(
|
||||
{DependencyLevel::required, elem.asString()}
|
||||
);
|
||||
std::string depName = elem.asString();
|
||||
auto level = DependencyLevel::required;
|
||||
switch (depName.at(0)) {
|
||||
case '!':
|
||||
depName = depName.substr(1);
|
||||
break;
|
||||
case '?':
|
||||
depName = depName.substr(1);
|
||||
level = DependencyLevel::optional;
|
||||
break;
|
||||
case '~':
|
||||
depName = depName.substr(1);
|
||||
level = DependencyLevel::weak;
|
||||
break;
|
||||
}
|
||||
pack.dependencies.push_back({level, depName});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user