OSDN Git Service

データタイプxmlとSQLiteでデータファイル名を変えた
authormasakih <masakih@users.sourceforge.jp>
Thu, 13 Mar 2014 10:59:52 +0000 (19:59 +0900)
committermasakih <masakih@users.sourceforge.jp>
Thu, 13 Mar 2014 10:59:52 +0000 (19:59 +0900)
KCD/HMCoreDataManager.m

index 1ca6851..efa00e7 100644 (file)
@@ -115,18 +115,19 @@ static NSManagedObjectModel *_managedObjectModel = nil;
             return nil;
         }
     }
-    
-    NSURL *url = [applicationFilesDirectory URLByAppendingPathComponent:@"KCD.storedata"];
+#ifdef DEBUG
+    NSURL *url = [applicationFilesDirectory URLByAppendingPathComponent:@"KCD.storedata.xml"];
+       NSString *storeType = NSXMLStoreType;
+#else
+       NSURL *url = [applicationFilesDirectory URLByAppendingPathComponent:@"KCD.storedata"];
+       NSString *storeType = NSSQLiteStoreType;
+#endif
        NSDictionary *options = @{
                                                          NSMigratePersistentStoresAutomaticallyOption : @YES,
                                                          NSInferMappingModelAutomaticallyOption : @YES
                                                          };
     NSPersistentStoreCoordinator *coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mom];
-#ifdef DEBUG
-    if (![coordinator addPersistentStoreWithType:NSXMLStoreType configuration:nil URL:url options:options error:&error]) {
-#else
-       if (![coordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:options error:&error]) {
-#endif
+    if (![coordinator addPersistentStoreWithType:storeType configuration:nil URL:url options:options error:&error]) {
         [[NSApplication sharedApplication] presentError:error];
         return nil;
     }