| 27 | : model_root_(std::move(model_root)) {} |
| 28 | |
| 29 | void ResourceBundle::add_file(std::string id, const std::filesystem::path & path) { |
| 30 | if (id.empty()) { |
| 31 | throw std::runtime_error("asset resource id must not be empty"); |
| 32 | } |
| 33 | if (!engine::io::is_existing_file(path)) { |
| 34 | throw std::runtime_error("asset resource file does not exist: " + path.string()); |
| 35 | } |
| 36 | auto [it, inserted] = files_.emplace(std::move(id), std::filesystem::weakly_canonical(path)); |
| 37 | if (!inserted) { |
| 38 | throw std::runtime_error("duplicate asset resource id: " + it->first); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | void ResourceBundle::add_tensor_source(std::string id, const std::filesystem::path & path, std::string tensor_prefix) { |
| 43 | const auto key = id; |
no test coverage detected