James Turner:
Here's a patch to locate the base package inside the application bundle on OS-X. The patch also disables the CPSForeground hack in boostrap.cxx, which is unnecessary if the we're running as a proper bundle rather than a Unix command line program. Both of these changes are only compiled if OSX_BUNDLE is defined (I'm doing this via a setting in ProjectBuilder), so if you're building on OS-X using configure + make, you shouldn't see any chance.
This commit is contained in:
parent
bf859a91c3
commit
093702d773
2 changed files with 22 additions and 3 deletions
|
@ -120,7 +120,7 @@ int main ( int argc, char **argv ) {
|
|||
#endif
|
||||
|
||||
// Keyboard focus hack
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) && !defined(OSX_BUNDLE)
|
||||
{
|
||||
PSN psn;
|
||||
|
||||
|
|
|
@ -268,8 +268,27 @@ bool fgInitFGRoot ( int argc, char **argv ) {
|
|||
root = "/FlightGear";
|
||||
#elif defined( WIN32 )
|
||||
root = "\\FlightGear";
|
||||
#elif defined( macintosh )
|
||||
root = "";
|
||||
#elif defined(OSX_BUNDLE)
|
||||
/* the following code looks for the base package directly inside
|
||||
the application bundle. This can be changed fairly easily by
|
||||
fiddling with the code below. And yes, I know it's ugly and verbose.
|
||||
*/
|
||||
CFBundleRef appBundle = CFBundleGetMainBundle();
|
||||
CFURLRef appUrl = CFBundleCopyBundleURL(appBundle);
|
||||
CFRelease(appBundle);
|
||||
|
||||
// look for a 'data' subdir directly inside the bundle : is there
|
||||
// a better place? maybe in Resources? I don't know ...
|
||||
CFURLRef dataDir = CFURLCreateCopyAppendingPathComponent(NULL, appUrl, CFSTR("data"), true);
|
||||
|
||||
// now convert down to a path, and the a c-string
|
||||
CFStringRef path = CFURLCopyFileSystemPath(dataDir, kCFURLPOSIXPathStyle);
|
||||
root = CFStringGetCStringPtr(path, CFStringGetSystemEncoding());
|
||||
|
||||
// tidy up.
|
||||
CFRelease(appBundle);
|
||||
CFRelease(dataDir);
|
||||
CFRelease(path);
|
||||
#else
|
||||
root = PKGLIBDIR;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue