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

Function globFilesInDirectories

Source/Falcor/Core/Platform/OS.cpp:154–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154std::vector<std::filesystem::path> globFilesInDirectories(
155 const std::filesystem::path& path,
156 const std::regex& regexPattern,
157 fstd::span<std::filesystem::path> directories,
158 bool firstMatchOnly
159)
160{
161 std::vector<std::filesystem::path> result;
162
163 // Check if this is an absolute path.
164 if (path.is_absolute())
165 {
166 result = globFilesInDirectory(path, regexPattern, firstMatchOnly);
167 }
168 else
169 {
170 // Search in other paths.
171 for (const auto& dir : directories)
172 {
173 std::filesystem::path fullPath = dir / path;
174 std::vector<std::filesystem::path> local = globFilesInDirectory(fullPath, regexPattern, firstMatchOnly);
175 result.reserve(result.size() + local.size());
176 for (auto&& it : local)
177 result.push_back(std::move(it));
178 if (firstMatchOnly && !result.empty())
179 break;
180 }
181 }
182
183 for (auto& it : result)
184 it = std::filesystem::canonical(it);
185
186 return result;
187}
188
189const std::vector<std::filesystem::path>& getShaderDirectoriesList()
190{

Callers

nothing calls this directly

Calls 5

globFilesInDirectoryFunction · 0.85
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected