diff --git a/src/test/java/builderpackage/FileTreeBuilder.java b/src/test/java/builderpackage/FileTreeBuilder.java index 436fe9b..1a58e48 100644 --- a/src/test/java/builderpackage/FileTreeBuilder.java +++ b/src/test/java/builderpackage/FileTreeBuilder.java @@ -69,6 +69,7 @@ public class FileTreeBuilder { System.out.println("Invalid directory path: " + directoryPath); return null; } + System.out.println(blackList); return buildFileTreeRecursively(root, blackList); } @@ -96,7 +97,7 @@ public class FileTreeBuilder { if (files != null) { for (File file : files) { if (file.isDirectory()) { - if (!isBlacklisted(file.getAbsolutePath(), blacklistPrefixes)) { + if (!isBlacklisted(file.getPath(), blacklistPrefixes)) { FileInfo child = buildFileTreeRecursively(file, blacklistPrefixes); fileInfo.addChild(child); } @@ -125,10 +126,11 @@ public class FileTreeBuilder { if (filePath.endsWith(".DS_Store") || filePath.endsWith(".DSStore")) { return true; } + System.out.println("黑名单过滤文件:" + filePath); for (String prefix : blacklistPrefixes) { - String path = FileTreeBuilder.class.getResource("").getPath(); - String prefixPath = path.substring(0, path.indexOf(File.separator + "target" + File.separator)) + File.separator; - if (filePath.startsWith(prefixPath + prefix)) { + // // String path = FileTreeBuilder.class.getResource("").getPath(); + // String prefixPath = path.substring(0, path.indexOf(File.separator + "target" + File.separator)) + File.separator; + if (filePath.startsWith(prefix)) { return true; } }