// Rename the old TouchDB directory to the name CouchbaseLite expects.
-(void)renameOldDirectory {
NSFileManager* fileManager = [NSFileManager defaultManager];
// If old TouchDB directory exists rename to new CouchbaseLite name.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString* oldPath = [paths[0] stringByAppendingPathComponent:@"TouchDB"];
if ([fileManager fileExistsAtPath:oldPath]) {
NSString *newPath = [paths[0] stringByAppendingPathComponent:@"CouchbaseLite"];
NSError *renameError = nil;
[fileManager moveItemAtPath:oldPath toPath:newPath error:&renameError];
if (renameError) {
NSLog(@"Error renaming TouchDB directory to CouchbaseLite %@", renameError.localizedDescription);
// handle error
}
}
}