Merge pull request #1041 from john-07/master
allow override diskCachePath
This commit is contained in:
commit
eac0b816f8
|
|
@ -71,6 +71,8 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
|
|||
*/
|
||||
- (id)initWithNamespace:(NSString *)ns;
|
||||
|
||||
-(NSString *)makeDiskCachePath:(NSString*)fullNamespace;
|
||||
|
||||
/**
|
||||
* Add a read-only cache path to search for images pre-cached by SDImageCache
|
||||
* Useful if you want to bundle pre-loaded images with your app
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
_memCache.name = fullNamespace;
|
||||
|
||||
// Init the disk cache
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
_diskCachePath = [paths[0] stringByAppendingPathComponent:fullNamespace];
|
||||
_diskCachePath = [self makeDiskCachePath:fullNamespace];
|
||||
|
||||
// Set decompression to YES
|
||||
_shouldDecompressImages = YES;
|
||||
|
|
@ -147,6 +146,12 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
|
|||
|
||||
#pragma mark ImageCache
|
||||
|
||||
// Init the disk cache
|
||||
-(NSString *)makeDiskCachePath:(NSString*)fullNamespace{
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
return [paths[0] stringByAppendingPathComponent:fullNamespace];
|
||||
}
|
||||
|
||||
- (void)storeImage:(UIImage *)image recalculateFromImage:(BOOL)recalculate imageData:(NSData *)imageData forKey:(NSString *)key toDisk:(BOOL)toDisk {
|
||||
if (!image || !key) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue