am 4c2aec09: am aa3e17e1: Merge "Return path including executable instead of without"

* commit '4c2aec09cf2da437f3995ff4cac87e4c20d1d4b0':
  Return path including executable instead of without
This commit is contained in:
Elliott Hughes 2014-11-20 18:47:24 +00:00 committed by Android Git Automerger
commit b99dbe9aaf
2 changed files with 10 additions and 10 deletions

View File

@ -20,11 +20,11 @@
void get_my_path(char *s, size_t maxLen)
{
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef bundleURL = CFBundleCopyBundleURL(mainBundle);
CFStringRef bundlePathString = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
CFRelease(bundleURL);
CFURLRef executableURL = CFBundleCopyExecutableURL(mainBundle);
CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle);
CFRelease(executableURL);
CFStringGetCString(bundlePathString, s, maxLen, kCFStringEncodingASCII);
CFRelease(bundlePathString);
CFStringGetCString(executablePathString, s, maxLen, kCFStringEncodingASCII);
CFRelease(executablePathString);
}

View File

@ -32,12 +32,12 @@
void get_my_path(char s[PATH_MAX])
{
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef bundleURL = CFBundleCopyBundleURL(mainBundle);
CFStringRef bundlePathString = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
CFRelease(bundleURL);
CFURLRef executableURL = CFBundleCopyExecutableURL(mainBundle);
CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle);
CFRelease(executableURL);
CFStringGetCString(bundlePathString, s, PATH_MAX - 1, kCFStringEncodingASCII);
CFRelease(bundlePathString);
CFStringGetCString(executablePathString, s, PATH_MAX-1, kCFStringEncodingASCII);
CFRelease(executablePathString);
char *x;
x = strrchr(s, '/');