mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-11 08:04:23 +08:00
delete before unzipping
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -44,6 +44,6 @@
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>CodePushDeploymentKey</key>
|
||||
<string>deployment-key-here</string>
|
||||
<string>5c73310a-cc93-4aa5-bf9f-81c6b648232c</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user