- #if 0
- TerminateAE() ;
- #endif
-}
-
-//----------------------------------------------------------------------
-// wxEntry
-//----------------------------------------------------------------------
-
-short gCurrentResource = -1 ;
-#if defined(WXMAKINGDLL) && defined(__DARWIN__)
-CFBundleRef gDylibBundle = NULL;
-#endif /* WXMAKINGDLL && __DARWIN__ */
-
-wxStAppResource::wxStAppResource()
-{
-#if defined(WXMAKINGDLL) && defined(__DARWIN__)
- // Open the shared library resource file if it is not yet open
- if (gCurrentResource == -1) {
- NSSymbol theSymbol;
- NSModule theModule;
- const char *theLibPath;
-
- gDylibBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.wxwindows.wxWindows"));
- if (gDylibBundle != NULL) {
- // wxWindows has been bundled into a framework
- // load the framework resources
-
- gCurrentResource = CFBundleOpenBundleResourceMap(gDylibBundle);
- }
- else {
- // wxWindows is a simple dynamic shared library
- // load the resources from the data fork of a separate resource file
- char *theResPath;
- char *theName;
- char *theExt;
- FSRef theResRef;
- OSErr theErr = noErr;
-
- // get the library path
- theSymbol = NSLookupAndBindSymbol("_gCurrentResource");
- theModule = NSModuleForSymbol(theSymbol);
- theLibPath = NSLibraryNameForModule(theModule);
-
- wxLogDebug( theLibPath );
-
- // allocate copy to replace .dylib.* extension with .rsrc
- theResPath = strdup(theLibPath);
- if (theResPath != NULL) {
- theName = strrchr(theResPath, '/');
- if (theName == NULL) {
- // no directory elements in path
- theName = theResPath;
- }
- // find ".dylib" shared library extension
- theExt = strstr(theName, ".dylib");
- // overwrite extension with ".rsrc"
- strcpy(theExt, ".rsrc");
-
- wxLogDebug( theResPath );
-
- theErr = FSPathMakeRef((UInt8 *) theResPath, &theResRef, false);
- if (theErr != noErr) {
- // try in current directory (using name only)
- theErr = FSPathMakeRef((UInt8 *) theName, &theResRef, false);
- }
-
- // free duplicated resource file path
- free(theResPath);