Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a65d5b3 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "Fix building on modern versions of Xcode and OS X." into lmp-mr1-dev

parents 0f86444b 017c97a5
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -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);
}
+9 −8
Original line number Diff line number Diff line
@@ -31,14 +31,15 @@

void get_my_path(char s[PATH_MAX])
{
    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;
    ProcessSerialNumber psn;
    GetCurrentProcess(&psn);
    CFDictionaryRef dict;
    dict = ProcessInformationCopyDictionary(&psn, 0xffffffff);
    CFStringRef value = (CFStringRef)CFDictionaryGetValue(dict,
                CFSTR("CFBundleExecutable"));
    CFStringGetCString(value, s, PATH_MAX - 1, kCFStringEncodingUTF8);
    x = strrchr(s, '/');
    if(x) x[1] = 0;
}