From 0b3079d66b6f486376c9ce40f7f146b930d979df Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 16 Dec 2019 12:44:52 +0800 Subject: [PATCH] Fix the test case compile warning of `SDWebImageTestDiskCache` --- Tests/Tests/SDWebImageTestCache.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Tests/Tests/SDWebImageTestCache.m b/Tests/Tests/SDWebImageTestCache.m index 7ef29cf7..68b2a154 100644 --- a/Tests/Tests/SDWebImageTestCache.m +++ b/Tests/Tests/SDWebImageTestCache.m @@ -9,6 +9,9 @@ #import "SDWebImageTestCache.h" #import +#import "SDFileAttributeHelper.h" + +static NSString * const SDWebImageTestDiskCacheExtendedAttributeName = @"com.hackemist.SDWebImageTestDiskCache"; @implementation SDWebImageTestMemoryCache @@ -104,4 +107,18 @@ 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