From e9412791bd53560143bd1e346a27016a75034c07 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Tue, 16 Jan 2018 23:14:36 +0800 Subject: [PATCH] Fix the getSize method which use the default file manager instead of current file manager --- SDWebImage/SDImageCache.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 378f0106..6b926186 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -588,7 +588,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { NSDirectoryEnumerator *fileEnumerator = [_fileManager enumeratorAtPath:self.diskCachePath]; for (NSString *fileName in fileEnumerator) { NSString *filePath = [self.diskCachePath stringByAppendingPathComponent:fileName]; - NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil]; + NSDictionary *attrs = [_fileManager attributesOfItemAtPath:filePath error:nil]; size += [attrs fileSize]; } });