summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-19 21:55:28 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-19 21:55:28 +0000
commit2097e9a1491e850545cd0c38522c22dafd2cf6af (patch)
treeb34b5858918fa096810443e54001213340fee375 /adb
parent26d2b64ba84e926e46e8d41214c75461dfeeda78 (diff)
parent20860a28c5be013da111cb794c92dae02aa30089 (diff)
downloadsystem_core-2097e9a1491e850545cd0c38522c22dafd2cf6af.zip
system_core-2097e9a1491e850545cd0c38522c22dafd2cf6af.tar.gz
system_core-2097e9a1491e850545cd0c38522c22dafd2cf6af.tar.bz2
am 20860a28: Merge "Fix building on modern versions of Xcode and OS X."
* commit '20860a28c5be013da111cb794c92dae02aa30089': Fix building on modern versions of Xcode and OS X.
Diffstat (limited to 'adb')
-rw-r--r--adb/get_my_path_darwin.c14
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);
}