|
From: Peter M. <Pet...@mi...> - 2004-10-28 17:49:29
|
Thats better.
Peter
static void
e3mac_load_plugins(const FSSpec *fileInDirToScan)
{ Boolean targetIsFolder;
Boolean wasAliased;
FSSpec theFSSpec;
FSRef theFSRef;
TQ3Int16 theIndex;
OSErr theErr;
CInfoPBRec thePB;
// Iterate through the directory, looking for plug-ins
theIndex = 1;
do
{
// Get the next file
thePB.dirInfo.ioFDirIndex = theIndex;
thePB.dirInfo.ioVRefNum = fileInDirToScan->vRefNum;
thePB.dirInfo.ioDrDirID = fileInDirToScan->parID;
thePB.dirInfo.ioNamePtr = theFSSpec.name;
theErr = PBGetCatInfoSync(&thePB);
if (theErr == noErr)
{
// Grab the file
theErr = FSMakeFSSpec(fileInDirToScan->vRefNum,
fileInDirToScan->parID, theFSSpec.name, &theFSSpec);
if (theErr == noErr)
{
// Grab the file's FSRef
theErr = FSpMakeFSRef(&theFSSpec, &theFSRef);
if (theErr == noErr)
{
// Resolve any aliases
targetIsFolder = true;
theErr = FSResolveAliasFileWithMountFlags ( &theFSRef, true,
&targetIsFolder, &wasAliased, kResolveAliasFileNoUI ) ;
if (theErr == noErr)
{
// If this isn't a directory, check the type
if (!targetIsFolder)
{
// If this is a plug-in, load it
if (thePB.hFileInfo.ioFlFndrInfo.fdType ==
kQ3XExtensionMacFileType &&
thePB.hFileInfo.ioFlFndrInfo.fdCreator ==
kQ3XExtensionMacCreatorType)
e3mac_load_plugin(&theFSSpec);
}
}
}
}
// Clear any error - don't stop if we hit an error at this point
theErr = noErr;
}
theIndex++;
}
while (theErr == noErr);
}
|