Skip to content

Instantly share code, notes, and snippets.

@jwhitehorn
Last active January 4, 2018 04:11
Show Gist options
  • Save jwhitehorn/933ff45e74adcecc7b7a2c9c1b12d360 to your computer and use it in GitHub Desktop.
Save jwhitehorn/933ff45e74adcecc7b7a2c9c1b12d360 to your computer and use it in GitHub Desktop.
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [documentPaths objectAtIndex:0];
NSString *checksum = nil;
BOOL initialSync = YES;
if([this isUpdatePending]){
NSString *filePath = [documentsDirectoryPath stringByAppendingPathComponent:@"updated.db"];
NSData *contents = [NSData dataWithContentsOfFile:filePath];
checksum = [contents MD5HexDigest];
initialSync = NO;
}else if([this hasPerformedInitialSync]){
NSString *filePath = [documentsDirectoryPath stringByAppendingPathComponent:@"database.db"];
NSData *contents = [NSData dataWithContentsOfFile:filePath];
checksum = [contents MD5HexDigest];
initialSync = NO;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment