mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-07 16:45:14 +08:00
extend new patchType: *.apk.hpatch & *.ppk.hpatch
This commit is contained in:
@@ -13,4 +13,9 @@
|
||||
+ (BOOL)bsdiffPatch:(NSString *)path
|
||||
origin:(NSString *)origin
|
||||
toDestination:(NSString *)destination;
|
||||
|
||||
+ (BOOL)hdiffPatch:(NSString *)path
|
||||
origin:(NSString *)origin
|
||||
toDestination:(NSString *)destination;
|
||||
|
||||
@end
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#import "BSDiff.h"
|
||||
#include "bspatch.h"
|
||||
|
||||
#include "../../../android/jni/hpatch.h"
|
||||
|
||||
@implementation BSDiff
|
||||
|
||||
@@ -34,4 +34,26 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (BOOL)hdiffPatch:(NSString *)patch
|
||||
origin:(NSString *)origin
|
||||
toDestination:(NSString *)destination
|
||||
{
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:patch]) {
|
||||
return NO;
|
||||
}
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:origin]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:destination]) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:destination error:nil];
|
||||
}
|
||||
|
||||
int err = hpatch_by_file([origin UTF8String], [destination UTF8String], [patch UTF8String]);
|
||||
if (err) {
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user