Ensure directory exists on init instead of on each save.
This commit is contained in:
parent
3fd19c16eb
commit
c79416bc2e
|
@ -43,6 +43,8 @@ static NSString * const SDDiskCacheExtendedAttributeName = @"com.hackemist.SDDis
|
|||
} else {
|
||||
self.fileManager = [NSFileManager new];
|
||||
}
|
||||
|
||||
[self createDirectory];
|
||||
}
|
||||
|
||||
- (BOOL)containsDataForKey:(NSString *)key {
|
||||
|
@ -80,9 +82,6 @@ static NSString * const SDDiskCacheExtendedAttributeName = @"com.hackemist.SDDis
|
|||
- (void)setData:(NSData *)data forKey:(NSString *)key {
|
||||
NSParameterAssert(data);
|
||||
NSParameterAssert(key);
|
||||
if (![self.fileManager fileExistsAtPath:self.diskCachePath]) {
|
||||
[self createDirectory];
|
||||
}
|
||||
|
||||
// get cache Path for image key
|
||||
NSString *cachePathForKey = [self cachePathForKey:key];
|
||||
|
|
Loading…
Reference in New Issue