Re: Error with [pluginBundle infoDictionary]
Re: Error with [pluginBundle infoDictionary]
- Subject: Re: Error with [pluginBundle infoDictionary]
- From: Trygve Inda <email@hidden>
- Date: Mon, 16 Oct 2006 06:16:56 +0000
- Thread-topic: Error with [pluginBundle infoDictionary]
Sorry,
The explanation below is fixed... The previous one was all wonky. :-)
- (void)testLoadPlugins
{
NSEnumerator*
enu = [[NSBundle pathsForResourcesOfType:@"plugin"
inDirectory:[[NSBundle mainBundle] builtInPlugInsPath]]
objectEnumerator];
NSString* pluginPath;
while ((pluginPath = [enu nextObject]))
{
NSBundle* pluginBundle = [NSBundle bundleWithPath:pluginPath];
if (pluginBundle)
{
NSDictionary* pluginDict = [pluginBundle infoDictionary];
NSString* pluginName = [pluginDict objectForKey:@"NSPrincipalClass"];
}
}
}
If I run this method once with a single plugin in the /Contents/PlugIns
folder of my app bundle, it works fine... pluginDict gets 17 keys.
However, if I add a second plugin file to the /Contents/PlugIns folder,
and run this method again, the original plugin still shows 17 keys, but the
new plugin only shows 4 keys which is wrong - its Info.plist also has 17
keys.
Note that the same thing happens if I run it once with zero plugins and then
run it again with plugins present... pluginDict only gets 4 keys and since
NSPrincipalClass is not one of them, it fails.
What is wrong here?
Is pathsForResourcesOfType somehow caching things so I can't rescan a folder
to load plugins?
Trygve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden