diff options
author | Stefan Gartner <stefang@aon.at> | 2003-05-12 18:59:08 +0400 |
---|---|---|
committer | Stefan Gartner <stefang@aon.at> | 2003-05-12 18:59:08 +0400 |
commit | 23e8e19f5c25c46a5e9543b26bc90de4e887584e (patch) | |
tree | fe91a5893eabb1876a5595eb5500f3038942b090 /source/blender/blenlib/intern/util.c | |
parent | 331eb81e09d78e51b4b3b4af687a4eb0ac6b5d81 (diff) |
added function to get the full path to the application bundle on os x
Diffstat (limited to 'source/blender/blenlib/intern/util.c')
-rw-r--r-- | source/blender/blenlib/intern/util.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index eb2109ba807..80813b1119e 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -69,6 +69,12 @@ #include <sys/time.h> #endif +#include <sys/param.h> + +#ifdef __APPLE__ +#include <CoreFoundation/CoreFoundation.h> +#endif + /* local */ static int add_win32_extension(char *name); @@ -834,3 +840,21 @@ void BLI_where_am_i(char *fullname, char *name) } } +/* + * returns absolute path to the app bundle + * only useful on OS X + */ +#ifdef __APPLE__ +char* BLI_getbundle(void) { + CFURLRef bundleURL; + CFStringRef pathStr; + char path[MAXPATHLEN]; + CFBundleRef mainBundle = CFBundleGetMainBundle(); + + bundleURL = CFBundleCopyBundleURL(mainBundle); + pathStr = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle); + CFStringGetCString(pathStr, path, MAXPATHLEN, kCFStringEncodingASCII); + return path; +} +#endif + |