mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Ensure creation of Application Data directory when initializing Managed Object Store. fixes #657
This commit is contained in:
@@ -113,8 +113,11 @@ static RKManagedObjectStore *defaultObjectStore = nil;
|
||||
_storeFilename = [storeFilename retain];
|
||||
|
||||
if (nilOrDirectoryPath == nil) {
|
||||
// If initializing into Application Data directory, ensure the directory exists
|
||||
nilOrDirectoryPath = [RKDirectory applicationDataDirectory];
|
||||
[RKDirectory ensureDirectoryExistsAtPath:nilOrDirectoryPath error:nil];
|
||||
} else {
|
||||
// If path given, caller is responsible for directory's existence
|
||||
BOOL isDir;
|
||||
NSAssert1([[NSFileManager defaultManager] fileExistsAtPath:nilOrDirectoryPath isDirectory:&isDir] && isDir == YES, @"Specified storage directory exists", nilOrDirectoryPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user