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
|
@ -43,8 +43,8 @@
|
||||||
#include "common/fs.h"
|
#include "common/fs.h"
|
||||||
#include "common/translation.h"
|
#include "common/translation.h"
|
||||||
|
|
||||||
#include "ApplicationServices/ApplicationServices.h" // for LSOpenFSRef
|
#include <ApplicationServices/ApplicationServices.h> // for LSOpenFSRef
|
||||||
#include "CoreFoundation/CoreFoundation.h" // for CF* stuff
|
#include <CoreFoundation/CoreFoundation.h> // for CF* stuff
|
||||||
|
|
||||||
// For querying number of MIDI devices
|
// For querying number of MIDI devices
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -132,17 +132,10 @@ void OSystem_MacOSX::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
|
||||||
OSystem_POSIX::addSysArchivesToSearchSet(s, priority);
|
OSystem_POSIX::addSysArchivesToSearchSet(s, priority);
|
||||||
|
|
||||||
// Get URL of the Resource directory of the .app bundle
|
// Get URL of the Resource directory of the .app bundle
|
||||||
CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
|
Common::String bundlePath = getResourceAppBundlePathMacOSX();
|
||||||
if (fileUrl) {
|
if (!bundlePath.empty()) {
|
||||||
// Try to convert the URL to an absolute path
|
// Success: search with a depth of 2 so the shaders are found
|
||||||
UInt8 buf[MAXPATHLEN];
|
s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath, 2), priority);
|
||||||
if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
|
|
||||||
// Success: Add it to the search path
|
|
||||||
Common::String bundlePath((const char *)buf);
|
|
||||||
// Search with a depth of 2 so the shaders are found
|
|
||||||
s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath, 2), priority);
|
|
||||||
}
|
|
||||||
CFRelease(fileUrl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,5 +29,6 @@ bool hasTextInClipboardMacOSX();
|
||||||
Common::U32String getTextFromClipboardMacOSX();
|
Common::U32String getTextFromClipboardMacOSX();
|
||||||
bool setTextInClipboardMacOSX(const Common::U32String &text);
|
bool setTextInClipboardMacOSX(const Common::U32String &text);
|
||||||
Common::String getDesktopPathMacOSX();
|
Common::String getDesktopPathMacOSX();
|
||||||
|
Common::String getResourceAppBundlePathMacOSX();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <Foundation/NSPathUtilities.h>
|
#include <Foundation/NSPathUtilities.h>
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#include <CoreFoundation/CFString.h>
|
#include <CoreFoundation/CFString.h>
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
|
||||||
#define NSPasteboardTypeString NSStringPboardType
|
#define NSPasteboardTypeString NSStringPboardType
|
||||||
|
@ -110,3 +111,18 @@ Common::String getDesktopPathMacOSX() {
|
||||||
return Common::String();
|
return Common::String();
|
||||||
return Common::String([path fileSystemRepresentation]);
|
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