Revert "Use Path instead of string to check file exclusions to fix windows-only bug where files were not being correctly excluded."

This reverts commit 59fcd70c8d718624a3ab107440debbfab51e0c50.
This commit is contained in:
Andreas Dangel
2015-09-04 21:11:49 +02:00
parent f964d3329f
commit 944082c53d

View File

@ -10,7 +10,6 @@ import java.io.FilenameFilter;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@ -278,7 +277,7 @@ public class CPDConfiguration extends AbstractConfiguration {
}
final FilenameFilter languageFilter = language.getFileFilter();
final Set<Path> exclusions = new HashSet<Path>();
final Set<String> exclusions = new HashSet<String>();
if (excludes != null) {
FileFinder finder = new FileFinder();
@ -286,10 +285,10 @@ public class CPDConfiguration extends AbstractConfiguration {
if (excludedFile.isDirectory()) {
List<File> files = finder.findFilesFrom(excludedFile, languageFilter, true);
for (File f : files) {
exclusions.add(f.toPath());
exclusions.add(f.getAbsolutePath());
}
} else {
exclusions.add(excludedFile.toPath());
exclusions.add(excludedFile.getAbsolutePath());
}
}
}
@ -297,7 +296,7 @@ public class CPDConfiguration extends AbstractConfiguration {
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
File f = new File(dir, name);
if (exclusions.contains(f.toPath())) {
if (exclusions.contains(f.getAbsolutePath())) {
System.err.println("Excluding " + f.getAbsolutePath());
return false;
}