Skip to content

Commit

Permalink
Merge pull request #78 from Microsoft/delete-old-package-error
Browse files Browse the repository at this point in the history
Prevent error in deleting old packages from failing the install operation.
  • Loading branch information
geof90 committed Nov 29, 2015
2 parents eeb4901 + 1a7a955 commit d25489c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions CodePushPackage.m
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@ + (void)installPackage:(NSDictionary *)updatePackage
NSString *previousPackageHash = [self getPreviousPackageHash:error];
if (!*error && previousPackageHash && ![previousPackageHash isEqualToString:packageHash]) {
NSString *previousPackageFolderPath = [self getPackageFolderPath:previousPackageHash];
[[NSFileManager defaultManager] removeItemAtPath:previousPackageFolderPath error:error];
if (*error) {
return;
// Error in deleting old package will not cause the entire operation to fail.
NSError *deleteError;
[[NSFileManager defaultManager] removeItemAtPath:previousPackageFolderPath error:&deleteError];
if (deleteError) {
NSLog(@"Error deleting old package: %@", deleteError);
}
}

Expand Down

0 comments on commit d25489c

Please sign in to comment.