diff options
| author | theo3 <arisstephenson2@gmail.com> | 2022-01-20 20:11:44 -0800 |
|---|---|---|
| committer | theo3 <arisstephenson2@gmail.com> | 2022-01-20 20:11:44 -0800 |
| commit | f8f137cdd1428d93356819aa016e51a7e7b9c74a (patch) | |
| tree | 67b7d63d95609363322aad07f49a9d85c8497f96 /tools/src/asset_processor/util.cpp | |
| parent | 25c9535e41b771b2e0148ccda0395f0bd06ef46a (diff) | |
| parent | 79d8d25be2f1391e289f98cd9bf2060727502126 (diff) | |
Merge remote-tracking branch 'upstream/master' into sub_080809D4
Diffstat (limited to 'tools/src/asset_processor/util.cpp')
| -rw-r--r-- | tools/src/asset_processor/util.cpp | 28 |
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 ""; +} |
