fix for zip empty dir
This commit is contained in:
parent
1ee74058a2
commit
74a6d38d24
@ -24,6 +24,13 @@ public class ZipDirectory {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fileToZip.isDirectory()) {
|
if (fileToZip.isDirectory()) {
|
||||||
|
if (fileName.endsWith("/")) {
|
||||||
|
zipOut.putNextEntry(new ZipEntry(fileName));
|
||||||
|
zipOut.closeEntry();
|
||||||
|
} else {
|
||||||
|
zipOut.putNextEntry(new ZipEntry(fileName + "/"));
|
||||||
|
zipOut.closeEntry();
|
||||||
|
}
|
||||||
final File[] children = fileToZip.listFiles();
|
final File[] children = fileToZip.listFiles();
|
||||||
for (final File childFile : children) {
|
for (final File childFile : children) {
|
||||||
zipFile(childFile, fileName + "/" + childFile.getName(), zipOut);
|
zipFile(childFile, fileName + "/" + childFile.getName(), zipOut);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user