Ensure directory exists on init instead of on each save.

This commit is contained in:
Tim Johnsen 2023-04-18 16:29:24 -07:00
parent 3fd19c16eb
commit c79416bc2e
1 changed files with 2 additions and 3 deletions

View File

@ -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];