Search code examples
iospathdirectorynsbundle

pathForDirectory method for NSBundle?


If I include a folder in my bundle (a real folder, the blue ones, not the yellow groups), how can I get the path for that folder from my bundle? The method I would usually use is...

[[NSBundle mainBundle] pathForResource:fileName ofType:______];

...but what "type" is a directory? Is there a "type" to use, or is there another method for accessing the paths of directories within the bundle?

Or am I going about this all wrong, and there's some other way for including folders of accessible documents in the bundle?


Solution

  • Directories can have extensions too. If yours doesn't have one, just pass @"" for the type parameter, -[NSBundle pathForResource:ofType:] works for directories too, not only files. At the end, a directory is also a resource :)