Commit f1935f07 authored by Tobias's avatar Tobias

fix library copying on device

parent 86072e81
...@@ -324,12 +324,23 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles"; ...@@ -324,12 +324,23 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
} }
NSFileManager *fileManager = [NSFileManager defaultManager]; NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL success = [fileManager replaceItemAtURL:self.persistentStoreURL
withItemAtURL:replacementURL NSURL *finalTargetURL = self.persistentStoreURL;
backupItemName:nil NSString *tmpName = [[NSUUID UUID] UUIDString];
options:0 NSURL *tmpTargetURL = [[finalTargetURL URLByDeletingLastPathComponent] URLByAppendingPathComponent:tmpName];
resultingItemURL:nil
error:&error]; BOOL success = [fileManager copyItemAtURL:replacementURL toURL:tmpTargetURL error:&error];
if (!success) {
NSLog(@"%s failed to copy store to tmp url with with error %@",__PRETTY_FUNCTION__,error);
error = nil;
}
success = [fileManager replaceItemAtURL:self.persistentStoreURL
withItemAtURL:tmpTargetURL
backupItemName:nil
options:0
resultingItemURL:nil
error:&error];
if (!success) { if (!success) {
NSLog(@"%s failed to replace store with error %@",__PRETTY_FUNCTION__,error); NSLog(@"%s failed to replace store with error %@",__PRETTY_FUNCTION__,error);
error = nil; error = nil;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment