From 2883d901b8687f5f721dc839d86c2cfad9ee1d73 Mon Sep 17 00:00:00 2001 From: "youhong.ai" Date: Fri, 7 Jul 2023 17:47:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/builderpackage/FileTreeBuilder.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } }