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:
commit
b99dbe9aaf
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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, '/');
|
||||
|
|
Loading…
Reference in New Issue