| 213 | } |
| 214 | |
| 215 | std::vector<File> searchForFiles(const File& directory, const std::string& regex) { |
| 216 | if (!std::filesystem::is_directory(directory)) |
| 217 | return {}; |
| 218 | |
| 219 | std::vector<File> matches; |
| 220 | std::regex match_pattern(regex); |
| 221 | |
| 222 | for (const auto& entry : std::filesystem::recursive_directory_iterator(directory)) { |
| 223 | std::string file_name = entry.path().filename().string(); |
| 224 | if (entry.is_regular_file() && std::regex_search(file_name, match_pattern)) |
| 225 | matches.push_back(entry.path()); |
| 226 | } |
| 227 | |
| 228 | return matches; |
| 229 | } |
| 230 | |
| 231 | std::vector<File> searchForDirectories(const File& directory, const std::string& regex) { |
| 232 | if (!std::filesystem::is_directory(directory)) |
no outgoing calls
no test coverage detected