diff options
Diffstat (limited to 'adb')
-rw-r--r-- | adb/get_my_path_darwin.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/adb/get_my_path_darwin.c b/adb/get_my_path_darwin.c index 5b95d15..9141b57 100644 --- a/adb/get_my_path_darwin.c +++ b/adb/get_my_path_darwin.c @@ -19,12 +19,12 @@ void get_my_path(char *s, size_t maxLen) { - ProcessSerialNumber psn; - GetCurrentProcess(&psn); - CFDictionaryRef dict; - dict = ProcessInformationCopyDictionary(&psn, 0xffffffff); - CFStringRef value = (CFStringRef)CFDictionaryGetValue(dict, - CFSTR("CFBundleExecutable")); - CFStringGetCString(value, s, maxLen, kCFStringEncodingUTF8); + CFBundleRef mainBundle = CFBundleGetMainBundle(); + CFURLRef bundleURL = CFBundleCopyBundleURL(mainBundle); + CFStringRef bundlePathString = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle); + CFRelease(bundleURL); + + CFStringGetCString(bundlePathString, s, maxLen, kCFStringEncodingASCII); + CFRelease(bundlePathString); } |