summaryrefslogtreecommitdiff
path: root/tools/src/asset_processor/util.cpp
diff options
context:
space:
mode:
authorHenny022p <info@henny022.de>2022-01-31 17:30:51 +0100
committerHenny022p <info@henny022.de>2022-01-31 17:30:51 +0100
commit2a53ee4bf2ee7eea617280118c2188bffec77ae5 (patch)
tree85ed631ab330f9ca3734bb77253a374e3ef0de21 /tools/src/asset_processor/util.cpp
parent9b60d9c5e24ed592524c25a9dc013417d6e7ee0c (diff)
parent2b8d880ffc0a4548d25dc613d53a908d36362d84 (diff)
merge master
Diffstat (limited to 'tools/src/asset_processor/util.cpp')
-rw-r--r--tools/src/asset_processor/util.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/src/asset_processor/util.cpp b/tools/src/asset_processor/util.cpp
new file mode 100644
index 00000000..a0effa3c
--- /dev/null
+++ b/tools/src/asset_processor/util.cpp
@@ -0,0 +1,28 @@
+#include "util.h"
+#include <iostream>
+#include <fmt/format.h>
+
+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);
+ }
+}
+
+std::string opt_param(const std::string& format, int defaultVal, int value) {
+ if (value != defaultVal) {
+ return fmt::format(format, value);
+ }
+ return "";
+}