diff --git a/CodePushPackage.m b/CodePushPackage.m index 10a6c78..4d1300b 100644 --- a/CodePushPackage.m +++ b/CodePushPackage.m @@ -228,8 +228,16 @@ NSString * const UnzippedFolderName = @"unzipped"; NSString * unzippedFolderPath = [CodePushPackage getUnzippedFolderPath]; NSMutableDictionary * mutableUpdatePackage = [updatePackage mutableCopy]; if (isZip) { - NSError *nonFailingError = nil; + if ([[NSFileManager defaultManager] fileExistsAtPath:unzippedFolderPath]) { + [[NSFileManager defaultManager] removeItemAtPath:unzippedFolderPath + error:&error]; + if (error) { + failCallback(error); + return; + } + } + NSError *nonFailingError = nil; [SSZipArchive unzipFileAtPath:downloadFilePath toDestination:unzippedFolderPath]; [[NSFileManager defaultManager] removeItemAtPath:downloadFilePath diff --git a/Examples/CodePushDemoApp/iOS/CodePushDemoApp/Info.plist b/Examples/CodePushDemoApp/iOS/CodePushDemoApp/Info.plist index e1033b9..6cb683d 100644 --- a/Examples/CodePushDemoApp/iOS/CodePushDemoApp/Info.plist +++ b/Examples/CodePushDemoApp/iOS/CodePushDemoApp/Info.plist @@ -44,6 +44,6 @@ NSLocationWhenInUseUsageDescription CodePushDeploymentKey - deployment-key-here + 5c73310a-cc93-4aa5-bf9f-81c6b648232c diff --git a/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java b/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java index 3275363..cde2ed7 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java @@ -152,9 +152,11 @@ public class FileUtils { ZipEntry entry; File destinationFolder = new File(destination); - if (!destinationFolder.exists()) { - destinationFolder.mkdirs(); + if (destinationFolder.exists()) { + deleteDirectory(destinationFolder); } + + destinationFolder.mkdirs(); byte[] buffer = new byte[WRITE_BUFFER_SIZE]; while ((entry = zipStream.getNextEntry()) != null) {