Merge pull request #5309 from eugenp/fix-zip-tutorial
fix for zip empty dir
This commit is contained in:
commit
7b1f5c5724
@ -24,6 +24,13 @@ public class ZipDirectory {
|
||||
return;
|
||||
}
|
||||
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();
|
||||
for (final File childFile : children) {
|
||||
zipFile(childFile, fileName + "/" + childFile.getName(), zipOut);
|
||||
|
Loading…
x
Reference in New Issue
Block a user