This commit is contained in:
Jesse Boyd 2016-08-29 16:21:14 +10:00
parent 3b73b2e9d8
commit da7a12bc00

View File

@ -51,13 +51,18 @@ public class Template extends SubCommand {
ZipEntry ze = zis.getNextEntry(); ZipEntry ze = zis.getNextEntry();
byte[] buffer = new byte[2048]; byte[] buffer = new byte[2048];
while (ze != null) { while (ze != null) {
String name = ze.getName().replace('\\', File.separatorChar).replace('/', File.separatorChar); if (!ze.isDirectory()) {
File newFile = new File((output + File.separator + name).replaceAll("__TEMP_DIR__", world)); String name = ze.getName().replace('\\', File.separatorChar).replace('/', File.separatorChar);
new File(newFile.getParent()).mkdirs(); File newFile = new File((output + File.separator + name).replaceAll("__TEMP_DIR__", world));
try (FileOutputStream fos = new FileOutputStream(newFile)) { File parent = newFile.getParentFile();
int len; if (parent != null) {
while ((len = zis.read(buffer)) > 0) { parent.mkdirs();
fos.write(buffer, 0, len); }
try (FileOutputStream fos = new FileOutputStream(newFile)) {
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
} }
} }
ze = zis.getNextEntry(); ze = zis.getNextEntry();