matchFiles method
Matches multiple file paths without accessing the file system.
files - The file paths to match
root - Optional root directory (defaults to current directory)
Implementation
PatternMatchingResult matchFiles(Iterable<String> files, [String? root]) {
final rootPath = root ?? p.current;
final matches = <FilePatternMatch>[];
for (final file in files) {
final relativePath = p.relative(file, from: rootPath);
// Check if the file matches any include patterns
if (!_matchesIncludePatterns(relativePath)) {
continue;
}
// Check if the file is excluded
if (_matchesExcludePatterns(relativePath)) {
continue;
}
matches.add(FilePatternMatch(relativePath));
}
return PatternMatchingResult(matches);
}