diff options
author | Al Sutton <al@funkyandroid.com> | 2014-11-19 19:50:48 +0000 |
---|---|---|
committer | Al Sutton <al@funkyandroid.com> | 2014-11-19 19:50:48 +0000 |
commit | f456d47c506d87265ce0ff6080cba5374dced011 (patch) | |
tree | 17978b77a0c5c8dc1fa26826ccbf9a504f5b4bd1 /adb | |
parent | 81906d4b0c508dc308606ca232eaa055255abd1e (diff) | |
download | system_core-f456d47c506d87265ce0ff6080cba5374dced011.zip system_core-f456d47c506d87265ce0ff6080cba5374dced011.tar.gz system_core-f456d47c506d87265ce0ff6080cba5374dced011.tar.bz2 |
Fix building on modern versions of Xcode and OS X.
Recent versions of XCode fail to compile the adb and fastboot binaries due to
two functions being deprecated in 10.9 (GetCurrentProcess and
ProcessInformationCopyDictionary), and the use of -Werrror.
This patch replaces the method implementations which use calls to methods
deprecated in the 10.9 SDK with versions which only call non-deprecated methods.
Change-Id: I855bf26aff45093ca9022924f3ecd1b80f2305a8
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); } |