added function to get the full path to the application bundle on os x
This commit is contained in:
@@ -203,6 +203,15 @@ void BLI_free_file_lines(struct LinkNode *lines);
|
|||||||
*/
|
*/
|
||||||
void BLI_where_am_i(char *fullname, char *name);
|
void BLI_where_am_i(char *fullname, char *name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* determines the full path to the application bundle on OS X
|
||||||
|
*
|
||||||
|
* @return path to application bundle
|
||||||
|
*/
|
||||||
|
#ifdef __APPLE__
|
||||||
|
char* BLI_getbundle(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* BLI_storage.h */
|
/* BLI_storage.h */
|
||||||
int BLI_filesize(int file);
|
int BLI_filesize(int file);
|
||||||
double BLI_diskfree(char *dir);
|
double BLI_diskfree(char *dir);
|
||||||
|
@@ -69,6 +69,12 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* local */
|
/* local */
|
||||||
|
|
||||||
static int add_win32_extension(char *name);
|
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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user