mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-30 21:03:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			830 B
		
	
	
	
		
			Objective-C
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			830 B
		
	
	
	
		
			Objective-C
		
	
	
	
	
	
| //
 | |
| //  BSDiff.m
 | |
| //  RCTHotUpdate
 | |
| //
 | |
| //  Created by lvbingru on 16/4/2.
 | |
| //  Copyright © 2016年 erica. All rights reserved.
 | |
| //
 | |
| 
 | |
| #import "BSDiff.h"
 | |
| #include "bspatch.h"
 | |
| 
 | |
| 
 | |
| @implementation BSDiff
 | |
| 
 | |
| + (BOOL)bsdiffPatch:(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 = beginPatch([origin UTF8String], [destination UTF8String], [patch UTF8String]);
 | |
|     if (err) {
 | |
|         return NO;
 | |
|     }
 | |
|     return YES;
 | |
| }
 | |
| 
 | |
| @end
 |