mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 12:35:15 +01:00
Fixes #1234
This commit is contained in:
parent
3b73b2e9d8
commit
da7a12bc00
@ -51,15 +51,20 @@ 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) {
|
||||||
|
if (!ze.isDirectory()) {
|
||||||
String name = ze.getName().replace('\\', File.separatorChar).replace('/', File.separatorChar);
|
String name = ze.getName().replace('\\', File.separatorChar).replace('/', File.separatorChar);
|
||||||
File newFile = new File((output + File.separator + name).replaceAll("__TEMP_DIR__", world));
|
File newFile = new File((output + File.separator + name).replaceAll("__TEMP_DIR__", world));
|
||||||
new File(newFile.getParent()).mkdirs();
|
File parent = newFile.getParentFile();
|
||||||
|
if (parent != null) {
|
||||||
|
parent.mkdirs();
|
||||||
|
}
|
||||||
try (FileOutputStream fos = new FileOutputStream(newFile)) {
|
try (FileOutputStream fos = new FileOutputStream(newFile)) {
|
||||||
int len;
|
int len;
|
||||||
while ((len = zis.read(buffer)) > 0) {
|
while ((len = zis.read(buffer)) > 0) {
|
||||||
fos.write(buffer, 0, len);
|
fos.write(buffer, 0, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ze = zis.getNextEntry();
|
ze = zis.getNextEntry();
|
||||||
}
|
}
|
||||||
zis.closeEntry();
|
zis.closeEntry();
|
||||||
|
Loading…
Reference in New Issue
Block a user