MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / GetCachedFiles

Method GetCachedFiles

Source/Internal/path_set.cpp:29–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include <Main/engine.h>
28
29void 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}

Callers

nothing calls this directly

Calls 8

GetAssetManagerMethod · 0.80
GetCachePathMethod · 0.80
DisplayErrorFunction · 0.70
findMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
validMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected