From fca7ee645ad16c90af0e0179ad2ce0c1cdc84fd5 Mon Sep 17 00:00:00 2001 From: "chaoyang.he" Date: Sat, 15 Jul 2023 17:53:22 +0800 Subject: [PATCH] xiugai --- src/test/java/BuilderPackageEcology.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/java/BuilderPackageEcology.java b/src/test/java/BuilderPackageEcology.java index a8ea1df..6c20c36 100644 --- a/src/test/java/BuilderPackageEcology.java +++ b/src/test/java/BuilderPackageEcology.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.List; import java.util.*; +import java.util.regex.Pattern; public class BuilderPackageEcology extends Application { @@ -115,7 +116,11 @@ public class BuilderPackageEcology extends Application { try { FileCompressor.compressFiles(filePaths, outputFile.getAbsolutePath(), path -> { String rootPath = Util.class.getResource("/").getPath(); - rootPath = rootPath.split(File.separator + FileTreeBuilder.targetPath)[0] + File.separator + FileTreeBuilder.targetPath + FileTreeBuilder.classPath; + if(rootPath.startsWith("/")){ + rootPath = rootPath.substring(1); + rootPath = rootPath.replace("/",File.separator); + } + rootPath = rootPath.split(Pattern.quote(File.separator + FileTreeBuilder.targetPath))[0] + File.separator + FileTreeBuilder.targetPath + FileTreeBuilder.classPath; String replace = "/ecology/" + (isEcology ? "WEB-INF/classes/" : "classbean/"); if (path.endsWith(".jar")) { replace = "/ecology/WEB-INF/lib/";