]> git.saurik.com Git - uikittools.git/commitdiff
Isolate stash directory from codesign validation.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 26 Jun 2015 06:31:19 +0000 (23:31 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 26 Jun 2015 06:31:19 +0000 (23:31 -0700)
libuicache.mm

index 800beb99e9a5f564d5c4e27efa5ec066de836aa3..0e107f4eb40ac1ed83451bc6fcfdccb7c0b9cda4 100644 (file)
@@ -12,9 +12,19 @@ static NSArray *(*_MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$e
 
 static NSArray *$MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(MIFileManager *self, SEL _cmd, NSURL *url, BOOL ignoring, NSError *error) {
     MIFileManager *manager(reinterpret_cast<MIFileManager *>([$MIFileManager defaultManager]));
-    if (NSURL *destiny = [manager destinationOfSymbolicLinkAtURL:url error:NULL])
-        url = destiny;
-    return _MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(self, _cmd, url, NO, error);
+    NSURL *destiny([manager destinationOfSymbolicLinkAtURL:url error:NULL]);
+    if (destiny == nil)
+        return _MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(self, _cmd, url, YES, error);
+
+    NSArray *prefix([url pathComponents]);
+    size_t skip([[destiny pathComponents] count]);
+    NSMutableArray *items([NSMutableArray array]);
+    for (NSURL *item in _MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(self, _cmd, destiny, YES, error)) {
+        NSArray *components([item pathComponents]);
+        [items addObject:[NSURL fileURLWithPathComponents:[prefix arrayByAddingObjectsFromArray:[components subarrayWithRange:NSMakeRange(skip, [components count] - skip)]]]];
+    }
+
+    return items;
 }
 
 __attribute__((__constructor__))