| 27 | #include <Main/engine.h> |
| 28 | |
| 29 | void PathSetUtil::GetCachedFiles(PathSet& path_set) { |
| 30 | PathSet new_path_set; |
| 31 | for (const auto& labeled_path : path_set) { |
| 32 | size_t space_pos = labeled_path.find(' '); |
| 33 | if (space_pos == std::string::npos) { |
| 34 | DisplayError("Error", ("No space found in labeled string: " + labeled_path).c_str()); |
| 35 | continue; |
| 36 | } |
| 37 | const std::string& type = labeled_path.substr(0, space_pos); |
| 38 | const std::string& path = labeled_path.substr(space_pos + 1, labeled_path.size() - (space_pos + 1)); |
| 39 | switch (type[0]) { |
| 40 | case 'i': |
| 41 | if (type == "image_sample") { |
| 42 | ImageSamplerRef ref = Engine::Instance()->GetAssetManager()->LoadSync<ImageSampler>(path); |
| 43 | if (ref.valid()) { |
| 44 | std::string fixed; |
| 45 | if (ref->GetCachePath(&fixed)) { |
| 46 | new_path_set.insert("image_sample_cache " + fixed); |
| 47 | } |
| 48 | } else { |
| 49 | LOGE << "Failed loading " << path << std::endl; |
| 50 | } |
| 51 | } |
| 52 | break; |
| 53 | default: |
| 54 | new_path_set.insert(labeled_path); |
| 55 | } |
| 56 | } |
| 57 | path_set = new_path_set; |
| 58 | } |
nothing calls this directly
no test coverage detected