Error with [pluginBundle infoDictionary]
Error with [pluginBundle infoDictionary]
- Subject: Error with [pluginBundle infoDictionary]
- From: Trygve Inda <email@hidden>
- Date: Mon, 16 Oct 2006 05:22:48 +0000
- Thread-topic: Error with [pluginBundle infoDictionary]
My app searches through its PlugIns folder to load Bundles.
My basic code looks like:
- (void)loadPlugins
// some stuff removed
NSString *appSupportSubpath = @"Application Support/MyApp/PlugIns";
libraryPaths = NSSearchPathForDirectoriesInDomains (NSLibraryDirectory,
NSAllDomainsMask - NSSystemDomainMask, YES);
libraryPathsEnum = [libraryPaths objectEnumerator];
while (currPath = [libraryPathsEnum nextObject])
{
[bundlePaths addObject:[currPath
stringByAppendingPathComponent:appSupportSubpath]];
}
bundlePathsEnum = [bundlePaths objectEnumerator];
while (folderPath = [bundlePathsEnum nextObject])
{
NSEnumerator* enumerator = [[NSBundle
pathsForResourcesOfType:@"plugin" inDirectory:folderPath] objectEnumerator];
NSString* pluginPath;
while ((pluginPath = [enumerator nextObject]))
{
[self activatePlugin:pluginPath];
}
}
- (void)activatePlugin:(NSString*)path
{
NSBundle* pluginBundle = [NSBundle bundleWithPath:path];
if (pluginBundle)
{
NSDictionary* pluginDict = [pluginBundle infoDictionary];
When I get here, pluginDict normally has 17 keys, 13 of which are from the
Info.plist, but if I copy a new Plugin to the proper folder and rerun
loadPlugins, the new one I added ends up with only 4 keys as follows:
type = mutable, count = 4, capacity = 4, pairs = (
{contents = "NSBundleResolvedPath"} =
/Users/trygve/Library/Application Support/pzizz/PlugIns/MyPlugin.plugin
{contents = "NSBundleResourcePath"} =
/Users/trygve/Library/Application/Support/pzizz/PlugIns/
MyPlugin.plugin/Contents/Resources
{contents = "NSBundleLanguagesList"} = <CFArray 0x31ef00 [0xa08011c0]>{type
= mutable-small, count = 1, values = (
{contents = "English.lproj"}
)}
{contents = "NSBundleInitialPath"} = /Users/trygve/Library/Application
Support/pzizz/PlugIns/MyPlugin.plugin
)}
It is not reading the actual Info.plist from the new bundle, even though is
sees the correct path information.
Any ideas?
I don't want to make the user quit the app to load new plugins.
Thanks,
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