|
@@ -14,6 +14,7 @@
|
|
|
#include <dlfcn.h>
|
|
#include <dlfcn.h>
|
|
|
|
|
|
|
|
@implementation FLEXMethod
|
|
@implementation FLEXMethod
|
|
|
|
|
+@synthesize imagePath = _imagePath;
|
|
|
@dynamic implementation;
|
|
@dynamic implementation;
|
|
|
|
|
|
|
|
+ (instancetype)buildMethodNamed:(NSString *)name withTypes:(NSString *)typeEncoding implementation:(IMP)implementation {
|
|
+ (instancetype)buildMethodNamed:(NSString *)name withTypes:(NSString *)typeEncoding implementation:(IMP)implementation {
|
|
@@ -156,11 +157,6 @@
|
|
|
_name = NSStringFromSelector(_selector);
|
|
_name = NSStringFromSelector(_selector);
|
|
|
_returnType = (FLEXTypeEncoding *)_signature.methodReturnType ?: "";
|
|
_returnType = (FLEXTypeEncoding *)_signature.methodReturnType ?: "";
|
|
|
_returnSize = _signature.methodReturnLength;
|
|
_returnSize = _signature.methodReturnLength;
|
|
|
-
|
|
|
|
|
- Dl_info exeInfo;
|
|
|
|
|
- if (dladdr(_objc_method, &exeInfo)) {
|
|
|
|
|
- _imagePath = exeInfo.dli_fname ? @(exeInfo.dli_fname) : nil;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark Public
|
|
#pragma mark Public
|
|
@@ -184,6 +180,17 @@
|
|
|
return _typeEncoding;
|
|
return _typeEncoding;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (NSString *)imagePath {
|
|
|
|
|
+ if (!_imagePath) {
|
|
|
|
|
+ Dl_info exeInfo;
|
|
|
|
|
+ if (dladdr(_objc_method, &exeInfo)) {
|
|
|
|
|
+ _imagePath = exeInfo.dli_fname ? @(exeInfo.dli_fname) : @"";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return _imagePath;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#pragma mark Misc
|
|
#pragma mark Misc
|
|
|
|
|
|
|
|
- (void)swapImplementations:(FLEXMethod *)method {
|
|
- (void)swapImplementations:(FLEXMethod *)method {
|