From 31d9d318e843299e8bd27f2ea2b86605355f147a Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 28 Sep 2021 11:56:12 -0700 Subject: [PATCH 1/5] Don't backup to NoCloud dir log the lib dir a --- ios/RNSqlite2.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ios/RNSqlite2.m b/ios/RNSqlite2.m index 2750842..10d2cde 100644 --- a/ios/RNSqlite2.m +++ b/ios/RNSqlite2.m @@ -53,7 +53,10 @@ - (dispatch_queue_t)getDatabaseQueue:(NSString *)dbName { -(NSString*) getDatabaseDir { NSString *libDir = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex: 0]; - return [libDir stringByAppendingPathComponent:@"NoCloud"]; + NSLog(@"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + NSLog(@"%@", libDir); + NSLog(@"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + return libDir; } -(id) getPathForDB:(NSString *)dbName { From d2363ac3f90b0551ed713cd5837c8c7d22e9feb6 Mon Sep 17 00:00:00 2001 From: Chris Drackett Date: Wed, 29 Sep 2021 11:43:50 -0700 Subject: [PATCH 2/5] store files in support directory --- ios/RNSqlite2.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ios/RNSqlite2.m b/ios/RNSqlite2.m index 10d2cde..6be228d 100644 --- a/ios/RNSqlite2.m +++ b/ios/RNSqlite2.m @@ -52,11 +52,10 @@ - (dispatch_queue_t)getDatabaseQueue:(NSString *)dbName { } -(NSString*) getDatabaseDir { - NSString *libDir = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex: 0]; - NSLog(@"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - NSLog(@"%@", libDir); - NSLog(@"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - return libDir; + NSString *appSupportDir = nil; + appSupportDir = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) objectAtIndex: 0]; + NSString *appBundleID = [[NSBundle mainBundle] bundleIdentifier]; + return [appSupportDir URLByAppendingPathComponent:appBundleID]; } -(id) getPathForDB:(NSString *)dbName { From 225fc0106327b2d8c4e8c1b985d241cd63837f4a Mon Sep 17 00:00:00 2001 From: Chris Drackett Date: Wed, 29 Sep 2021 11:50:59 -0700 Subject: [PATCH 3/5] don't mark files to not sync --- ios/RNSqlite2.m | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ios/RNSqlite2.m b/ios/RNSqlite2.m index 6be228d..fa91570 100644 --- a/ios/RNSqlite2.m +++ b/ios/RNSqlite2.m @@ -30,16 +30,11 @@ -(void)pluginInitialize { dbQueues = [NSMutableDictionary dictionaryWithCapacity:0]; NSString *dbDir = [self getDatabaseDir]; - // create "NoCloud" if it doesn't exist + // create storage directory if it doesn't exist [[NSFileManager defaultManager] createDirectoryAtPath: dbDir withIntermediateDirectories: NO attributes: nil error: nil]; - // make it non-syncable to iCloud - NSURL *url = [ NSURL fileURLWithPath: dbDir]; - [url setResourceValue: [NSNumber numberWithBool: YES] - forKey: NSURLIsExcludedFromBackupKey - error: nil]; } - (dispatch_queue_t)getDatabaseQueue:(NSString *)dbName { From c32d5c3d6f7f42b849c38dcbf506c203bfe283c3 Mon Sep 17 00:00:00 2001 From: Chris Drackett Date: Wed, 29 Sep 2021 12:11:03 -0700 Subject: [PATCH 4/5] update database dir to be a url --- ios/RNSqlite2.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/RNSqlite2.m b/ios/RNSqlite2.m index fa91570..a3839c1 100644 --- a/ios/RNSqlite2.m +++ b/ios/RNSqlite2.m @@ -28,7 +28,7 @@ -(void)pluginInitialize { logDebug(@"pluginInitialize()"); cachedDatabases = [NSMutableDictionary dictionaryWithCapacity:0]; dbQueues = [NSMutableDictionary dictionaryWithCapacity:0]; - NSString *dbDir = [self getDatabaseDir]; + NSURL *dbDir = [self getDatabaseDir]; // create storage directory if it doesn't exist [[NSFileManager defaultManager] createDirectoryAtPath: dbDir @@ -46,8 +46,8 @@ - (dispatch_queue_t)getDatabaseQueue:(NSString *)dbName { return q; } --(NSString*) getDatabaseDir { - NSString *appSupportDir = nil; +-(NSURL*) getDatabaseDir { + NSURL *appSupportDir = nil; appSupportDir = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) objectAtIndex: 0]; NSString *appBundleID = [[NSBundle mainBundle] bundleIdentifier]; return [appSupportDir URLByAppendingPathComponent:appBundleID]; From f12a6c13d844150dd064a482938a1feb26ae994c Mon Sep 17 00:00:00 2001 From: Chris Drackett Date: Wed, 29 Sep 2021 12:17:45 -0700 Subject: [PATCH 5/5] maybe this will combine correctly? --- ios/RNSqlite2.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/RNSqlite2.m b/ios/RNSqlite2.m index a3839c1..5089139 100644 --- a/ios/RNSqlite2.m +++ b/ios/RNSqlite2.m @@ -28,7 +28,7 @@ -(void)pluginInitialize { logDebug(@"pluginInitialize()"); cachedDatabases = [NSMutableDictionary dictionaryWithCapacity:0]; dbQueues = [NSMutableDictionary dictionaryWithCapacity:0]; - NSURL *dbDir = [self getDatabaseDir]; + NSString *dbDir = [self getDatabaseDir]; // create storage directory if it doesn't exist [[NSFileManager defaultManager] createDirectoryAtPath: dbDir @@ -46,11 +46,11 @@ - (dispatch_queue_t)getDatabaseQueue:(NSString *)dbName { return q; } --(NSURL*) getDatabaseDir { - NSURL *appSupportDir = nil; +-(NSString*) getDatabaseDir { + NSString *appSupportDir = nil; appSupportDir = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) objectAtIndex: 0]; NSString *appBundleID = [[NSBundle mainBundle] bundleIdentifier]; - return [appSupportDir URLByAppendingPathComponent:appBundleID]; + return [NSString stringWithFormat:@"%@/%@", appSupportDir, appBundleID]; } -(id) getPathForDB:(NSString *)dbName {