Compare commits
No commits in common. "ff69438198b4cc109d4e75e262ecabde77f7e395" and "6651f788e1538a31bfbaa0be7aa1194e6ee6b143" have entirely different histories.
ff69438198
...
6651f788e1
|
@ -31,7 +31,7 @@ public class BuilderPackageEcology extends Application {
|
|||
public void start(Stage primaryStage) {
|
||||
primaryStage.setTitle("EBU7部开发一部自动打包工具");
|
||||
|
||||
FileInfo fileInfo = FileTreeBuilder.buildFileTree();
|
||||
FileInfo fileInfo = FileTreeBuilder.buildFileTree("target/");
|
||||
rootItem = createTreeItem(fileInfo);
|
||||
|
||||
treeView = new TreeView<>(rootItem);
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
package builderpackage;
|
||||
|
||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class FileTreeBuilder {
|
||||
|
||||
public static final String DIRECTORY_TYPE = "文件夹";
|
||||
public static final String FILE_TYPE = "文件";
|
||||
|
||||
public static FileInfo buildFileTree() {
|
||||
String directoryPath = "target/";
|
||||
List<String> blackList = new ArrayList<>();
|
||||
public static FileInfo buildFileTree(String directoryPath) {
|
||||
File root = new File(directoryPath);
|
||||
if (!root.exists() || !root.isDirectory()) {
|
||||
System.out.println("Invalid directory path: " + directoryPath);
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> blacklistPrefixes = Arrays.asList(
|
||||
"target" + File.separator + "generated-sources",
|
||||
"target" + File.separator + "generated-test-sources",
|
||||
|
@ -24,26 +25,7 @@ public class FileTreeBuilder {
|
|||
"target" + File.separator + "classes" + File.separator + "ln",
|
||||
"target" + File.separator + "classes" + File.separator + "cus_getlog"
|
||||
);
|
||||
Properties properties = new Properties();
|
||||
try (InputStream inputStream = FileTreeBuilder.class.getClassLoader().getResourceAsStream("application.properties")) {
|
||||
properties.load(inputStream);
|
||||
// 通过键获取属性值
|
||||
String value = properties.getProperty("packageBlackPaths");
|
||||
if (StrUtil.isNotBlank(value)) {
|
||||
String[] split = value.split(";");
|
||||
Collections.addAll(blackList, split);
|
||||
}
|
||||
directoryPath = properties.getProperty("packageRootPath");
|
||||
blackList.addAll(blacklistPrefixes);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
File root = new File(directoryPath);
|
||||
if (!root.exists() || !root.isDirectory()) {
|
||||
System.out.println("Invalid directory path: " + directoryPath);
|
||||
return null;
|
||||
}
|
||||
return buildFileTreeRecursively(root, blackList);
|
||||
return buildFileTreeRecursively(root, blacklistPrefixes);
|
||||
}
|
||||
|
||||
public static FileInfo buildFileTree(String directoryPath, List<String> blacklistPrefixes) {
|
||||
|
@ -122,4 +104,9 @@ public class FileTreeBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String directoryPath = "target/";
|
||||
FileInfo fileTree = buildFileTree(directoryPath);
|
||||
printFileTree(fileTree, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue