BSPatch is a cocoapod library that implements the popular bspatch utility as detailed by Colin Percival here. It will apply a patchfile generated by the bsdiff binary diffing utility onto a base file, to generate the outfile that would've been used as the target to generate the diff.
Requires only XCode, and CocoaPods.
BSPatch is not available through CocoaPods. To install it, simply add the following line to your Podfile, to reference it from this repo:
pod 'BSPatch', :git => 'https://github.com/hriddhidey/BSPatch.git', :branch => '0.6.0'Simply import the library and call the bspatch() function.
#import <BSPatch/BSPatch.h>
...
...
const char *oldFile = // path to your original file
const char *newFile = // path to your new file - does not need to exist, file will be created if not found.
const char *patchfile = // patch to your patch file
int res = bspatch(oldFile, newFile, patchfile);
// Returns 0 if successful
if (res != 0) {
NSLog(@"Error while patching file. Error status: %@", [@(res) stringValue]);
return;
}
BSPatch is available under the MIT license.