fix copy bundled files for ios

This commit is contained in:
Ari Lazier 2016-05-13 15:44:25 -07:00
parent 125dd0d1c7
commit e32df4e815
1 changed files with 8 additions and 3 deletions

View File

@ -75,9 +75,14 @@ void copy_bundled_realm_files()
if (![path containsString:@".realm"]) { if (![path containsString:@".realm"]) {
continue; continue;
} }
NSError *error;
if (![manager copyItemAtPath:[resourcePath stringByAppendingPathComponent:path] toPath:[docsDir stringByAppendingPathComponent:path] error:&error]) { NSString *docsPath = [docsDir stringByAppendingPathComponent:path];
throw std::runtime_error((std::string)"Failed to copy file at path " + path.UTF8String); if ([manager fileExistsAtPath:docsPath]) {
continue;
}
if (![manager copyItemAtPath:[resourcePath stringByAppendingPathComponent:path] toPath:docsPath error:nil]) {
throw std::runtime_error((std::string)"Failed to copy file at path " + path.UTF8String + " to path " + docsPath.UTF8String);
} }
} }
} }