Skip to content

Instantly share code, notes, and snippets.

@greg
Created July 13, 2015 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greg/04ac59de24c21aa5e9b7 to your computer and use it in GitHub Desktop.
Save greg/04ac59de24c21aa5e9b7 to your computer and use it in GitHub Desktop.
Skedule backup file extractor
//
// main.c
// Skedule Data Extractor
//
// Created by Greg Omelaenko on 27/09/12.
// Copyright (c) 2012 Mostly Infinite Studios. All rights reserved.
//
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
NSURL *url = [NSURL fileURLWithPath:@(argv[1])];
NSData *importedData = [NSData dataWithContentsOfURL:url];
NSFileWrapper *archive = [[NSFileWrapper alloc] initWithSerializedRepresentation:importedData];
NSData *database = [[[archive fileWrappers] objectForKey:@"data.sqlite"] regularFileContents];
[database writeToURL:[[url URLByDeletingLastPathComponent] URLByAppendingPathComponent:@"data.sqlite"] atomically:YES];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment