feat: Support excluding paths based using glob-style matching.
package com.synopsys.integration.detect.tool.detector.file;
import java.io.File;
+import java.nio.file.FileSystems;
import java.nio.file.Path;
+import java.nio.file.PathMatcher;
import java.util.List;
import java.util.function.Predicate;
@@ -43,7 +45,9 @@ public class DetectDetectorFileFilter implements Predicate<File> {
for (final String excludedDirectory : excludedDirectoryPaths) {
final Path excludedDirectoryPath = new File(excludedDirectory).toPath();
final Path relativeDirectoryPath = sourcePath.relativize(file.toPath());
- if (relativeDirectoryPath.endsWith(excludedDirectoryPath)) {
+ PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:" + excludedDirectory);
+
+ if (relativeDirectoryPath.endsWith(excludedDirectoryPath) || pathMatcher.matches(file.toPath())) {
return true;
}
}
