MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ discover_headers() [2/2]

std::vector< std::filesystem::path > MayaFlux::Reflect::Tool::discover_headers ( const std::vector< std::filesystem::path > & roots,
std::string_view marker )
nodiscard

discover_headers() for another request marker, such as MF_DESCRIBE_FUNCTION.

The marker must be followed by '(' on its line, so MF_DESCRIBE does not match MF_DESCRIBE_FUNCTION and the reverse. Generated sidecars are skipped.

Definition at line 50 of file Discovery.cpp.

52{
53 std::vector<std::filesystem::path> found;
54 std::error_code code;
55 for (const auto& root : roots) {
56 if (std::filesystem::is_regular_file(root, code)) {
57 if (is_header(root) && has_request(root, marker)) {
58 found.push_back(std::filesystem::canonical(root, code));
59 }
60 continue;
61 }
62 for (std::filesystem::recursive_directory_iterator it(root, code), end; it != end; it.increment(code)) {
63 if (code) {
64 break;
65 }
66 if (it->is_regular_file(code) && is_header(it->path()) && has_request(it->path(), marker)) {
67 found.push_back(std::filesystem::canonical(it->path(), code));
68 }
69 }
70 }
71 std::ranges::sort(found);
72 found.erase(std::ranges::unique(found).begin(), found.end());
73 return found;
74}