mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-11 08:04:23 +08:00
clear rolled back package files
This commit is contained in:
@@ -475,11 +475,22 @@ NSString * const UnzippedFolderName = @"unzipped";
|
||||
{
|
||||
NSError *error;
|
||||
NSMutableDictionary *info = [self getCurrentPackageInfo:&error];
|
||||
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *currentPackageFolderPath = [self getCurrentPackageFolderPath:&error];
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSError *deleteError;
|
||||
[[NSFileManager defaultManager] removeItemAtPath:currentPackageFolderPath
|
||||
error:&deleteError];
|
||||
if (deleteError) {
|
||||
NSLog(@"Error deleting current package contents at %@", currentPackageFolderPath);
|
||||
}
|
||||
|
||||
[info setValue:info[@"previousPackage"] forKey:@"currentPackage"];
|
||||
[info removeObjectForKey:@"previousPackage"];
|
||||
|
||||
|
||||
@@ -187,6 +187,8 @@ public class CodePushPackage {
|
||||
|
||||
public void rollbackPackage() throws IOException {
|
||||
WritableMap info = getCurrentPackageInfo();
|
||||
String currentPackageFolderPath = getCurrentPackageFolderPath();
|
||||
CodePushUtils.deleteDirectoryAtPath(currentPackageFolderPath);
|
||||
info.putString(CURRENT_PACKAGE_KEY, CodePushUtils.tryGetString(info, PREVIOUS_PACKAGE_KEY));
|
||||
info.putNull(PREVIOUS_PACKAGE_KEY);
|
||||
updateCurrentPackageInfo(info);
|
||||
|
||||
Reference in New Issue
Block a user