MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / resolvePathPattern

Method resolvePathPattern

Source/Falcor/Core/AssetResolver.cpp:63–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63std::vector<std::filesystem::path> AssetResolver::resolvePathPattern(
64 const std::filesystem::path& path,
65 const std::string& pattern,
66 bool firstMatchOnly,
67 AssetCategory category
68) const
69{
70 FALCOR_CHECK(category < AssetCategory::Count, "Invalid asset category.");
71
72 std::regex regex(pattern);
73
74 // If this is an existing absolute path, or a relative path to the working directory, search it.
75 std::filesystem::path absolute = std::filesystem::absolute(path);
76 std::vector<std::filesystem::path> resolved = globFilesInDirectory(absolute, regex, firstMatchOnly);
77 if (!resolved.empty())
78 return resolved;
79
80 // Otherwise, try to resolve using search paths.
81 // First try resolving for the specified asset category.
82 resolved = mSearchContexts[size_t(category)].resolvePathPattern(path, regex, firstMatchOnly);
83
84 // If not resolved, try resolving for the Any asset category.
85 if (category != AssetCategory::Any && resolved.empty())
86 resolved = mSearchContexts[size_t(AssetCategory::Any)].resolvePathPattern(path, regex, firstMatchOnly);
87
88 if (resolved.empty())
89 logWarning("Failed to resolve path pattern '{}/{}' for asset type '{}'.", path, pattern, category);
90
91 return resolved;
92}
93
94void AssetResolver::addSearchPath(const std::filesystem::path& path, SearchPathPriority priority, AssetCategory category)
95{

Callers 2

loadUdimTextureMethod · 0.80
CPU_TESTFunction · 0.80

Calls 3

globFilesInDirectoryFunction · 0.85
logWarningFunction · 0.50
emptyMethod · 0.45

Tested by 1

CPU_TESTFunction · 0.64