Re: Re: Error with [pluginBundle infoDictionary]
Re: Re: Error with [pluginBundle infoDictionary]
- Subject: Re: Re: Error with [pluginBundle infoDictionary]
- From: "Corey O'Connor" <email@hidden>
- Date: Tue, 17 Oct 2006 07:11:20 -0700
On 10/16/06, Trygve Inda <email@hidden> wrote:
>
> I tried switching to using NSFileManager but the infoDictionary for
> any found bundle is still missing all of the attributes in the
> Info.plist. The entire dictionary is something like:
...
> Info.plist. Does anybody know another reason NSBundle's infoDictionary
> method would not return the actual Info.plist? Should I assume it's
> broken and just manually load the Info.plist file?
Hi Corey,
NSFileManager worked for me.... And I had the same results as you list above
with pathforResourcesOfType.
bundlePathsEnum = [bundlePaths objectEnumerator];
while (folderPath = [bundlePathsEnum nextObject])
{
NSEnumerator* enumerator = [[[NSFileManager defaultManager]
directoryContentsAtPath:folderPath] objectEnumerator];
NSString* pluginPath;
while ((pluginPath = [enumerator nextObject]))
{
if ([[pluginPath pathExtension] isEqualToString:@"myextension"])
{
pluginPath = [[folderPath stringByAppendingString:@"/"]
stringByAppendingString:pluginPath];
// Then this can be called
NSBundle* pluginBundle = [NSBundle bundleWithPath:path];
NSDictionary* pluginDict = [pluginBundle infoDictionary];
}
}
}
}
That's about what I ended up using, except I still had to load the
Info.plist manually. So where:
NSDictionary* pluginDict = [pluginBundle infoDictionary];
I have:
NSString* info_path = [[pluginBundle bundlePath]
stringByAppendingPathComponent: @"Info.plist"];
NSDictionary* pluginDict = [NSDictionary
dictionaryWithContentsOfFile: info_path];
I have no idea why this was required, but otherwise I can't read the
properties out of the Info.plist. Ah well.
--
-Corey O'Connor
_______________________________________________
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