From e32df4e815ad5d36feecfe843e802ce493cc35d8 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Fri, 13 May 2016 15:44:25 -0700 Subject: [PATCH] fix copy bundled files for ios --- src/ios/platform.mm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ios/platform.mm b/src/ios/platform.mm index fbfe2f57..94373209 100644 --- a/src/ios/platform.mm +++ b/src/ios/platform.mm @@ -75,9 +75,14 @@ void copy_bundled_realm_files() if (![path containsString:@".realm"]) { continue; } - NSError *error; - if (![manager copyItemAtPath:[resourcePath stringByAppendingPathComponent:path] toPath:[docsDir stringByAppendingPathComponent:path] error:&error]) { - throw std::runtime_error((std::string)"Failed to copy file at path " + path.UTF8String); + + NSString *docsPath = [docsDir stringByAppendingPathComponent:path]; + 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); } } }