]> git.saurik.com Git - winterboard.git/commitdiff
Create /tmp/UIImages right before actually storing.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 25 Nov 2014 23:55:19 +0000 (15:55 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 25 Nov 2014 23:55:19 +0000 (15:55 -0800)
Library.mm

index 0479b3e315fedff4cb143f63806bdb3b71dc22f0..58576876c17345be283b5feea6450410710a00f8 100644 (file)
@@ -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<int (*)(const char *, int, mode_t)>(&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];
 }