]> git.saurik.com Git - uikittools.git/blob - libuicache.mm
800beb99e9a5f564d5c4e27efa5ec066de836aa3
[uikittools.git] / libuicache.mm
1 #include <objc/runtime.h>
2 #include <Foundation/Foundation.h>
3
4 @interface MIFileManager
5 + (MIFileManager *) defaultManager;
6 - (NSURL *) destinationOfSymbolicLinkAtURL:(NSURL *)url error:(NSError *)error;
7 @end
8
9 static Class $MIFileManager;
10
11 static NSArray *(*_MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$)(MIFileManager *self, SEL _cmd, NSURL *url, BOOL ignoring, NSError *error);
12
13 static NSArray *$MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(MIFileManager *self, SEL _cmd, NSURL *url, BOOL ignoring, NSError *error) {
14 MIFileManager *manager(reinterpret_cast<MIFileManager *>([$MIFileManager defaultManager]));
15 if (NSURL *destiny = [manager destinationOfSymbolicLinkAtURL:url error:NULL])
16 url = destiny;
17 return _MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$(self, _cmd, url, NO, error);
18 }
19
20 __attribute__((__constructor__))
21 static void initialize() {
22 $MIFileManager = objc_getClass("MIFileManager");
23 SEL sel(@selector(urlsForItemsInDirectoryAtURL:ignoringSymlinks:error:));
24 Method method(class_getInstanceMethod($MIFileManager, sel));
25 _MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$ = reinterpret_cast<NSArray *(*)(MIFileManager *, SEL, NSURL *, BOOL, NSError *)>(method_getImplementation(method));
26 method_setImplementation(method, reinterpret_cast<IMP>(&$MIFileManager$urlsForItemsInDirectoryAtURL$ignoringSymlinks$error$));
27 }