MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / enumerateDirectories

Method enumerateDirectories

src/app/MediaFileSystem.cpp:161–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161int MediaFileSystem::enumerateDirectories(const std::filesystem::path& path, enumerate_callback_t callback, bool allowDuplicates)
162{
163 int numRawResults = 0;
164 std::unordered_set<std::string> resultSet;
165 for (const auto& fs : m_FileSystems)
166 {
167 if (allowDuplicates)
168 {
169 int result = fs->enumerateDirectories(path, callback, true);
170 if (result >= 0)
171 numRawResults += result;
172 }
173 else
174 {
175 fs->enumerateDirectories(path,
176 [&resultSet](std::string_view name)
177 {
178 resultSet.insert(std::string(name));
179 }, true);
180 }
181 }
182
183 if (!allowDuplicates)
184 {
185 // pass the deduplicated names to the caller
186 std::for_each(resultSet.begin(), resultSet.end(), callback);
187 return int(resultSet.size());
188 }
189
190 return numRawResults;
191}

Callers 1

FindScenesMethod · 0.45

Calls 3

beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected