Fix the test case compile warning of `SDWebImageTestDiskCache`

This commit is contained in:
DreamPiggy 2019-12-16 12:44:52 +08:00
parent d44a5a331e
commit 0b3079d66b
1 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,9 @@
#import "SDWebImageTestCache.h" #import "SDWebImageTestCache.h"
#import <SDWebImage/SDImageCacheConfig.h> #import <SDWebImage/SDImageCacheConfig.h>
#import "SDFileAttributeHelper.h"
static NSString * const SDWebImageTestDiskCacheExtendedAttributeName = @"com.hackemist.SDWebImageTestDiskCache";
@implementation SDWebImageTestMemoryCache @implementation SDWebImageTestMemoryCache
@ -104,4 +107,18 @@
return size; return size;
} }
- (nullable NSData *)extendedDataForKey:(nonnull NSString *)key {
NSString *cachePathForKey = [self cachePathForKey:key];
return [SDFileAttributeHelper extendedAttribute:SDWebImageTestDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil];
}
- (void)setExtendedData:(nullable NSData *)extendedData forKey:(nonnull NSString *)key {
NSString *cachePathForKey = [self cachePathForKey:key];
if (!extendedData) {
[SDFileAttributeHelper removeExtendedAttribute:SDWebImageTestDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil];
} else {
[SDFileAttributeHelper setExtendedAttribute:SDWebImageTestDiskCacheExtendedAttributeName value:extendedData atPath:cachePathForKey traverseLink:NO overwrite:YES error:nil];
}
}
@end @end