X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FPath.cpp;h=36837f6f9a06e2f530c0316f3f93db18d38813cc;hb=0a9735c5f7bbbaa24ac2e3e4fa745c6dfbc95a18;hp=d6b048d7d2c4af9f071cd687babdaced5279e0ad;hpb=f1cba8ff64b369792fd49f5ddf90e8126ab476ac;p=lyx.git diff --git a/src/support/Path.cpp b/src/support/Path.cpp index d6b048d7d2..36837f6f9a 100644 --- a/src/support/Path.cpp +++ b/src/support/Path.cpp @@ -63,4 +63,30 @@ int PathChanger::pop() #define PathChanger(x) unnamed_PathChanger; + +#ifdef __APPLE__ + +#include + +int getPrivateFrameworkPathName(char * buf, unsigned len, char const * framework) +{ + // Get our application's main bundle from Core Foundation + CFBundleRef myAppsBundle = CFBundleGetMainBundle(); + int result = 0 ; + if (NULL != myAppsBundle) { + CFURLRef baseURL = CFBundleCopyPrivateFrameworksURL( myAppsBundle ); + if (NULL != baseURL) { + CFURLRef bundleURL = CFURLCreateCopyAppendingPathComponent( kCFAllocatorSystemDefault, baseURL, + CFStringCreateWithCString( kCFAllocatorSystemDefault, framework, CFStringGetSystemEncoding() ), + false ); + if (NULL != bundleURL) { + result = CFURLGetFileSystemRepresentation( bundleURL, TRUE, (UInt8*)buf, len ); + } + } + } + return result; +} + +#endif + // in merged builds this is not the last line.