fix: 导出zip问题修复

This commit is contained in:
yjz
2024-03-08 16:38:42 +08:00
parent 7ff313188e
commit 79790ea497
@@ -34,7 +34,11 @@ public class ZipUtil {
try {
zos = new ZipOutputStream(out);
File sourceFile = new File(srcDir);
compress(sourceFile, zos, sourceFile.getName().substring(0,sourceFile.getName().lastIndexOf("_")), KeepDirStructure);
String name = sourceFile.getName();
if (sourceFile.getName().contains("_")){
name = sourceFile.getName().substring(0, sourceFile.getName().lastIndexOf("_"));
}
compress(sourceFile, zos, name, KeepDirStructure);
long end = System.currentTimeMillis();
System.out.println("压缩完成,耗时:" + (end - start) + " ms");