Restructure asset processor

This commit is contained in:
octorock
2021-11-07 18:38:04 +01:00
parent 473bc5f260
commit e44d0e3fc9
45 changed files with 3832 additions and 2522 deletions
+29
View File
@@ -0,0 +1,29 @@
#include "util.h"
#include <iostream>
void check_call(const std::vector<std::string>& cmd) {
std::string cmdstr;
bool first = true;
for (const auto& segment : cmd) {
if (first) {
first = false;
} else {
cmdstr += " ";
}
cmdstr += segment;
}
int code = system(cmdstr.c_str());
if (code != 0) {
std::cerr << cmdstr << " failed with return code " << code << std::endl;
std::exit(1);
}
}
// https://github.com/nlohmann/json/issues/642#issuecomment-311937344
std::string to_string(const nlohmann::json& j) {
if (j.type() == nlohmann::json::value_t::string) {
return j.get<std::string>();
}
return j.dump();
}