mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEnginePackGenerator-extension.git
synced 2025-12-20 07:19:19 +00:00
Actually made automatic resourcepacks working lol.
This commit is contained in:
@@ -36,7 +36,7 @@ public class ExtensionMain implements Extension {
|
||||
|
||||
try (ZipOutputStream zipOutputStream = new ZipOutputStream(Files.newOutputStream(generatedPackZip))) {
|
||||
// 压缩文件夹
|
||||
ZipUtil.compressFolder(generatedPack, generatedPack.getName(), zipOutputStream);
|
||||
ZipUtil.compressFolder(generatedPack, null, zipOutputStream);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -13,8 +13,16 @@ public class ZipUtil {
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isDirectory()) {
|
||||
if (folderName == null) {
|
||||
compressFolder(file, file.getName(), zipOutputStream);
|
||||
continue;
|
||||
};
|
||||
compressFolder(file, folderName + "/" + file.getName(), zipOutputStream);
|
||||
} else {
|
||||
if (folderName == null) {
|
||||
addToZipFile(file.getName(), file, zipOutputStream);
|
||||
continue;
|
||||
};
|
||||
addToZipFile(folderName + "/" + file.getName(), file, zipOutputStream);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user