- else {
-#ifdef __DARWIN__
- // Open the shared library resource file if it is not yet open
- NSSymbol theSymbol;
- NSModule theModule;
- const char *theLibPath;
-
- gSharedLibraryBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.wxwindows.wxWindows"));
- if (gSharedLibraryBundle != NULL) {
- // wxWindows has been bundled into a framework
- // load the framework resources
-
- gSharedLibraryResource = CFBundleOpenBundleResourceMap(gSharedLibraryBundle);
- }
- else {
- // wxWindows is a simple dynamic shared library
- // load the resources from the data fork of a separate resource file
- wxString theResPath;
- wxString theName;
- FSRef theResRef;
- OSErr theErr = noErr;
-
- // get the library path
- theSymbol = NSLookupAndBindSymbol("_gSharedLibraryResource");
- theModule = NSModuleForSymbol(theSymbol);
- theLibPath = NSLibraryNameForModule(theModule);
-
- // if we call wxLogDebug from here then, as wxTheApp hasn't been
- // created yet when we're called from wxApp::Initialize(), wxLog
- // is going to create a default stderr-based log target instead of
- // the expected normal GUI one -- don't do it, if we really want
- // to see this message just use fprintf() here
-#if 0
- wxLogDebug( wxT("wxMac library installation name is '%s'"),
- theLibPath );
-#endif
-
- // allocate copy to replace .dylib.* extension with .rsrc
- if (theLibPath != NULL) {
-#if wxUSE_UNICODE
- theResPath = wxString(theLibPath, wxConvLocal);
-#else
- theResPath = wxString(theLibPath);
-#endif
- // replace '_core' with '' in case of multi-lib build
- theResPath.Replace(wxT("_core"), wxEmptyString);
- // replace ".dylib" shared library extension with ".rsrc"
- theResPath.Replace(wxT(".dylib"), wxT(".rsrc"));
- // Find the begining of the filename
- theName = theResPath.AfterLast('/');
-
-#if 0
- wxLogDebug( wxT("wxMac resources file name is '%s'"),
- theResPath.mb_str() );
-#endif
-
- theErr = FSPathMakeRef((UInt8 *) theResPath.mb_str(), &theResRef, false);
- if (theErr != noErr) {
- // try in current directory (using name only)
- theErr = FSPathMakeRef((UInt8 *) theName.mb_str(), &theResRef, false);
- }
-
- // open the resource file
- if (theErr == noErr) {
- theErr = FSOpenResourceFile( &theResRef, 0, NULL, fsRdPerm,
- &gSharedLibraryResource);
- }
- if (theErr != noErr) {
-#ifdef __WXDEBUG__
- wxLogDebug( wxT("unable to open wxMac resource file '%s'\n"),
- theResPath.mb_str() );
-#endif // __WXDEBUG__
- }