From 1448ea259dd64512b387212d77adec91f909378a Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 25 Nov 2014 15:55:19 -0800 Subject: [PATCH 1/1] Create /tmp/UIImages right before actually storing. --- Library.mm | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Library.mm b/Library.mm index 0479b3e..5857687 100644 --- a/Library.mm +++ b/Library.mm @@ -2001,7 +2001,9 @@ static UIImage *WBCacheUIImage(const Original_ &original, NSString *name, NSStri name = [name stringByAppendingString:@".png"]; UIImage *image(WBCacheImage(original, [=](){ return $pathForFile$inBundle$(name, _UIKitBundle(), true); }, key)); if (image != nil && UIDebug_) { - NSString *path([@"/tmp/UIImages/" stringByAppendingString:name]); + NSString *path(@"/tmp/UIImages"); + [Manager_ createDirectoryAtPath:path withIntermediateDirectories:YES attributes:@{NSFilePosixPermissions: @0777} error:NULL]; + path = [NSString stringWithFormat:@"%@/%@", path, name]; if (![Manager_ fileExistsAtPath:path]) [UIImagePNGRepresentation(image) writeToFile:path atomically:YES]; } return image; @@ -2505,13 +2507,5 @@ MSInitialize { //MSHookFunction(reinterpret_cast(&open), MSHake(open)); - if (UIDebug_ && ![Manager_ fileExistsAtPath:@"/tmp/UIImages"]) { - NSError *error(nil); - if (![Manager_ createDirectoryAtPath:@"/tmp/UIImages" withIntermediateDirectories:NO attributes:[NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithShort:0777], NSFilePosixPermissions, - nil] error:&error]) - NSLog(@"WB:Error: cannot create /tmp/UIImages (%@)", error); - } - [pool release]; } -- 2.45.2