Skip to content

Commit

Permalink
Merge pull request #1043 from Catrobat/CAT-963
Browse files Browse the repository at this point in the history
[CAT-963] Can't download programs
cat-963 #close fixed
  • Loading branch information
avihric committed Aug 7, 2014
2 parents c45ef54 + 3fa81a2 commit 77dcb71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion catroid/src/org/catrobat/catroid/utils/UtilZip.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public static boolean unZipFile(String zipFileName, String outDirectory) {
byte[] data = new byte[Constants.BUFFER_8K];
file = new File(zipFileName);
zipInputStream = new ZipInputStream(new BufferedInputStream(new FileInputStream(file)));

ZipEntry zipEntry;

while ((zipEntry = zipInputStream.getNextEntry()) != null) {
Expand All @@ -127,14 +128,15 @@ public static boolean unZipFile(String zipFileName, String outDirectory) {
if (zipEntry.isDirectory()) {
File entryFile = new File(Utils.buildPath(outDirectory, zipEntry.getName()));
if (!entryFile.mkdir() && !entryFile.isDirectory()) {
zipInputStream.close();
throw new IOException(ERROR_FOLDER_NOT_CREATED);
}
zipInputStream.close();
continue;
}

File entryFile = new File(Utils.buildPath(outDirectory, zipEntry.getName()));
if (!entryFile.getParentFile().mkdirs() && !entryFile.getParentFile().isDirectory()) {
zipInputStream.close();
throw new IOException(ERROR_FOLDER_NOT_CREATED);
}
FileOutputStream fileOutputStream = new FileOutputStream(entryFile);
Expand Down

0 comments on commit 77dcb71

Please sign in to comment.