Re: Unable to get resources from bundle
Re: Unable to get resources from bundle
- Subject: Re: Unable to get resources from bundle
- From: Douglas Davidson <email@hidden>
- Date: Fri, 1 Jul 2005 09:37:11 -0700
On Jul 1, 2005, at 9:32 AM, Darrin Cardani wrote:
I have an iMovie plugin that includes some resource files in the
Resources folder inside the plugin's bundle. They're a custom
resource type. In the plugin, I make the following calls to get the
list of resources:
NSBundle* ourBundle = [NSBundle
bundleWithIdentifier:@"ouridentifier"];
NSString* resourcesPath = [ourBundle resourcePath];
mPresets = [ourBundle pathsForResourcesOfType:@"preset"
inDirectory:resourcesPath];
UInt32 numPresets = [mPresets count];
Retrieving the bundle works correctly, as does getting the
resources path. However, the call to
pathsForResourcesOfType:inDirectory: returns an empty array. I have
verified that there are files of type "preset" in the Resources
directory. I also tried setting the type string to nil, as the docs
indicate that this will return all resources in the given
directory. That also returns nil. Obviously, there are other
resources in that directory, such as the plugin's .nib file, and
some images. So what am I missing about this method? Why am I
always getting back a 0-length array?
You are not using the API correctly. The call to -resourcePath is
unnecessary, and the last argument to -
pathsForResourcesOfType:inDirectory: should be nil. This argument is
intended to be used only if the resources are in a subdirectory of
the resources directory, in which case it should be the relative path
from the resources directory to that subdirectory. There is already
a bug against the documentation for this, and a clarification is
being prepared.
Douglas Davidson
_______________________________________________
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