]> git.saurik.com Git - cycript.git/commitdiff
Abstract folder for Frameworks into a #defiine.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 8 Jul 2010 02:40:37 +0000 (02:40 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 8 Jul 2010 02:40:37 +0000 (02:40 +0000)
Trampoline.t.cpp

index 6a87b5dfdd85bad78c3f123281883618ea88aefc..78c81837098ff6bc0bcf97171d6c44c137da3369 100644 (file)
@@ -50,6 +50,9 @@ static _finline void dlset(Baton *baton, Type_ &function, const char *name, void
         baton->dlerror();
 }
 
+#define Framework(framework) \
+    "/System/Library/Frameworks/" #framework ".framework/" #framework
+
 void *Routine(void *arg) {
     Baton *baton(reinterpret_cast<Baton *>(arg));
 
@@ -57,13 +60,13 @@ void *Routine(void *arg) {
     dlset(baton, dlopen, "dlopen");
 
     if (baton->dlsym(RTLD_DEFAULT, "JSEvaluateScript") == NULL)
-        dlopen("/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore", RTLD_GLOBAL | RTLD_LAZY);
+        dlopen(Framework(JavaScriptCore), RTLD_GLOBAL | RTLD_LAZY);
 
     void *(*objc_getClass)(const char *);
     dlset(baton, objc_getClass, "objc_getClass");
 
     if (objc_getClass("WebUndefined") == NULL)
-        dlopen("/System/Library/Frameworks/WebKit.framework/WebKit", RTLD_GLOBAL | RTLD_LAZY);
+        dlopen(Framework(WebKit), RTLD_GLOBAL | RTLD_LAZY);
 
     void *handle(dlopen(baton->library, RTLD_LAZY | RTLD_LOCAL));
     if (handle == NULL) {