summaryrefslogtreecommitdiffstats
path: root/fastboot
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-19 22:00:18 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-19 22:00:18 +0000
commit6309cb35f79188319429a6110a10bd933136421b (patch)
treead1a6a675264264644c266ee35f70bdb4a128d00 /fastboot
parent29e142760d238476943ca7afcc3bebe937a524ff (diff)
parent2097e9a1491e850545cd0c38522c22dafd2cf6af (diff)
downloadsystem_core-6309cb35f79188319429a6110a10bd933136421b.zip
system_core-6309cb35f79188319429a6110a10bd933136421b.tar.gz
system_core-6309cb35f79188319429a6110a10bd933136421b.tar.bz2
am 2097e9a1: am 20860a28: Merge "Fix building on modern versions of Xcode and OS X."
* commit '2097e9a1491e850545cd0c38522c22dafd2cf6af': Fix building on modern versions of Xcode and OS X.
Diffstat (limited to 'fastboot')
-rw-r--r--fastboot/util_osx.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fastboot/util_osx.c b/fastboot/util_osx.c
index 26b832a..e80a8f3 100644
--- a/fastboot/util_osx.c
+++ b/fastboot/util_osx.c
@@ -31,14 +31,15 @@
void get_my_path(char s[PATH_MAX])
{
- char *x;
- ProcessSerialNumber psn;
- GetCurrentProcess(&psn);
- CFDictionaryRef dict;
- dict = ProcessInformationCopyDictionary(&psn, 0xffffffff);
- CFStringRef value = (CFStringRef)CFDictionaryGetValue(dict,
- CFSTR("CFBundleExecutable"));
- CFStringGetCString(value, s, PATH_MAX - 1, kCFStringEncodingUTF8);
+ CFBundleRef mainBundle = CFBundleGetMainBundle();
+ CFURLRef bundleURL = CFBundleCopyBundleURL(mainBundle);
+ CFStringRef bundlePathString = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
+ CFRelease(bundleURL);
+
+ CFStringGetCString(bundlePathString, s, PATH_MAX - 1, kCFStringEncodingASCII);
+ CFRelease(bundlePathString);
+
+ char *x;
x = strrchr(s, '/');
if(x) x[1] = 0;
}