MACOSX: Pull a getResourceAppBundlePathMacOSX() wrapper from addSysArchivesToSearchSet()
This commit is contained in:
parent
63e2c001bb
commit
5118c60874
3 changed files with 23 additions and 13 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <CoreFoundation/CFString.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
|
||||
#define NSPasteboardTypeString NSStringPboardType
|
||||
|
@ -110,3 +111,18 @@ Common::String getDesktopPathMacOSX() {
|
|||
return Common::String();
|
||||
return Common::String([path fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
Common::String getResourceAppBundlePathMacOSX() {
|
||||
CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
|
||||
if (fileUrl) {
|
||||
// Try to convert the URL to an absolute path
|
||||
UInt8 buf[MAXPATHLEN];
|
||||
if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
|
||||
CFRelease(fileUrl);
|
||||
return Common::String((const char *)buf);
|
||||
}
|
||||
CFRelease(fileUrl);
|
||||
}
|
||||
|
||||
return Common::String();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue