--- np2/macosx/np2opening.cpp 2003/11/03 10:19:43 1.2 +++ np2/macosx/np2opening.cpp 2004/01/11 16:58:47 1.5 @@ -38,20 +38,34 @@ PicHandle getBMPfromPath(char* path, Rec return(getbmp(fsc, srt)); } -PicHandle getBMPfromResource(const char* name, Rect* srt) { +bool getResourceFile(const char* name, FSSpec* fsc) { CFURLRef url = NULL; FSRef fsr; - FSSpec fsc; - PicHandle pict = NULL; + bool ret = false; + CFStringRef str = CFSTRj(name); - url=CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTRj(name), CFSTR("bmp"), NULL); + if (!str) return (false); + url=CFBundleCopyResourceURL(CFBundleGetMainBundle(), str, NULL, NULL); + CFRelease(str); if (url) { if (CFURLGetFSRef(url, &fsr)) { - FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, &fsc, NULL); - pict = getbmp(fsc, srt); + if (FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, fsc, NULL) == noErr) { + ret = true; + } } CFRelease(url); } + return(ret); +} + + +PicHandle getBMPfromResource(const char* name, Rect* srt) { + FSSpec fsc; + PicHandle pict = NULL; + + if (getResourceFile(name, &fsc)) { + pict = getbmp(fsc, srt); + } return(pict); } @@ -60,7 +74,7 @@ void openingNP2(void) { GrafPtr port; PicHandle pict = NULL; - pict = getBMPfromResource("nekop2", &srt); + pict = getBMPfromResource("nekop2.bmp", &srt); if (pict) { GetPort(&port); SetPortWindowPort(hWndMain);