优化自动打包工具

dev
youhong.ai 2023-07-07 17:47:35 +08:00
parent c2f67e8c1f
commit 2883d901b8
1 changed files with 6 additions and 4 deletions

View File

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