mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-23 04:09:43 +00:00
Fix process name in NSLog()
This commit is contained in:
parent
8588e2b36b
commit
947280d80a
@ -1,7 +1,10 @@
|
||||
#import "NSBundle_dyld.h"
|
||||
#import <limits.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSProcessInfo.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <algorithm>
|
||||
#include "../util/log.h"
|
||||
@ -16,6 +19,17 @@ __attribute__((constructor)) static void myinit()
|
||||
LOG << "Swizzling methods in NSBundle\n";
|
||||
|
||||
MethodSwizzle(objc_getMetaClass("NSBundle"), @selector(mainBundle), @selector(x_mainBundle));
|
||||
|
||||
const char* last = strrchr(g_darwin_executable_path, '/');
|
||||
if (last != 0)
|
||||
{
|
||||
last++;
|
||||
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString* str = [NSString stringWithUTF8String:last];
|
||||
[[NSProcessInfo processInfo] setProcessName:str];
|
||||
[pool drain];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user