-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTweak.xmi
More file actions
32 lines (23 loc) · 1004 Bytes
/
Tweak.xmi
File metadata and controls
32 lines (23 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extern "C" void HookObjcFunctions( const char *appName );
static NSString *preferenceFilePath = @"/private/var/mobile/Library/Preferences/cdi.itracer.plist";
// Tweak starts here
%ctor {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// Only hook Apps the user has selected in itracer's settings panel
NSString *appId = [[NSBundle mainBundle] bundleIdentifier];
// Load itracer preferences
NSMutableDictionary *preferences = [[NSMutableDictionary alloc] initWithContentsOfFile:preferenceFilePath];
id shouldHook = [preferences objectForKey:appId];
if ( (shouldHook == nil) || (! [shouldHook boolValue]) ) {
NSLog(@"itracer - Profiling disabled for %@", appId);
[preferences release];
[pool drain];
return;
}
// Initialize DB storage
NSLog(@"itracer - Profiling enabled for %@", appId);
HookObjcFunctions( [ appId UTF8String ] );
[preferences release];
[pool drain];
}
/* vim: set filetype=objc : */