From 0a1907564a0d186c68edb6049cca32ed2429103f Mon Sep 17 00:00:00 2001 From: Yueyu Date: Wed, 28 Apr 2021 06:02:36 +0800 Subject: [PATCH] clean up --- .../src/main/java/org/scratchjr/android/ScratchJrUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/ScratchJr/app/src/main/java/org/scratchjr/android/ScratchJrUtil.java b/android/ScratchJr/app/src/main/java/org/scratchjr/android/ScratchJrUtil.java index c967ff7..73a5050 100644 --- a/android/ScratchJr/app/src/main/java/org/scratchjr/android/ScratchJrUtil.java +++ b/android/ScratchJr/app/src/main/java/org/scratchjr/android/ScratchJrUtil.java @@ -119,11 +119,11 @@ public class ScratchJrUtil { */ public static boolean zipFileAtPath(String sourcePath, String toLocation) { File sourceFile = new File(sourcePath); - if (sourceFile.exists()) { - sourceFile.delete(); - } try { BufferedInputStream origin; + // we don't need to remove file at `toLocation` + // because `FileOutputStream` will overwrite the file + // if no `append` parameter is passed FileOutputStream dest = new FileOutputStream(toLocation); ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream( dest));