зеркало из https://github.com/mozilla/gecko-dev.git
335166 When libwidget.rsrc is a symbolic link, it's not loaded, causing missing cursors and nsWindow assertions. Death to FSSpec, use CFBundle/CFURL to locate libwidget.rsrc. r=josh sr=pink
This commit is contained in:
Родитель
c24f237041
Коммит
149497b9dc
|
@ -36,8 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsMacResources.h"
|
||||
#include <Resources.h>
|
||||
#include <Processes.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
short nsMacResources::mRefNum = kResFileNotOpened;
|
||||
short nsMacResources::mSaveResFile = 0;
|
||||
|
@ -46,21 +45,26 @@ short nsMacResources::mSaveResFile = 0;
|
|||
nsresult nsMacResources::OpenLocalResourceFile()
|
||||
{
|
||||
if (mRefNum == kResFileNotOpened) {
|
||||
ProcessSerialNumber PSN;
|
||||
ProcessInfoRec pinfo;
|
||||
FSSpec appSpec;
|
||||
|
||||
PSN.highLongOfPSN = 0;
|
||||
PSN.lowLongOfPSN = kCurrentProcess;
|
||||
pinfo.processInfoLength = sizeof(pinfo);
|
||||
pinfo.processName = NULL;
|
||||
pinfo.processAppSpec = &appSpec;
|
||||
|
||||
if (GetProcessInformation(&PSN, &pinfo) == noErr) {
|
||||
FSSpec resSpec = { appSpec.vRefNum, appSpec.parID, "\plibwidget.rsrc" };
|
||||
FSRef resRef;
|
||||
if (FSpMakeFSRef(&resSpec, &resRef) == noErr)
|
||||
FSOpenResourceFile(&resRef, 0, NULL, fsRdPerm, &mRefNum);
|
||||
CFBundleRef appBundle = ::CFBundleGetMainBundle();
|
||||
if (appBundle) {
|
||||
CFURLRef executable = ::CFBundleCopyExecutableURL(appBundle);
|
||||
if (executable) {
|
||||
CFURLRef binDir = ::CFURLCreateCopyDeletingLastPathComponent(
|
||||
kCFAllocatorDefault, executable);
|
||||
if (binDir) {
|
||||
CFURLRef resourceFile = ::CFURLCreateCopyAppendingPathComponent(
|
||||
kCFAllocatorDefault, binDir,
|
||||
CFSTR("libwidget.rsrc"), PR_FALSE);
|
||||
if (resourceFile) {
|
||||
FSRef resourceRef;
|
||||
if (::CFURLGetFSRef(resourceFile, &resourceRef))
|
||||
::FSOpenResourceFile(&resourceRef, 0, NULL, fsRdPerm, &mRefNum);
|
||||
::CFRelease(resourceFile);
|
||||
}
|
||||
::CFRelease(binDir);
|
||||
}
|
||||
::CFRelease(executable);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mRefNum == kResFileNotOpened)
|
||||
|
|
Загрузка…
Ссылка в новой задаче