Siarhei Fedartsou
Siarhei Fedartsou

Reputation: 1873

-[NSBundle pathForResource:ofType:inDirectory:] returns nil for localized resources

I have a such bundle structure:

bundle's root
------atlases
------------en.lproj
--------------------test-hd.plist
------------es.lproj
--------------------test-hd.plist

But when I'm trying to get test-hd.plist for current localization using this code

[[NSBundle mainBundle] pathForResource:@"test-hd.plist" ofType:nil inDirectory:@"atlases"]

it always returns nil. Where is my mistake? How can I fix it? P.S. "atlases" folder is added as folder reference and test-hd.plist is always available by straight path [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"atlases/en.lproj/test-hd.plist"]

Upvotes: 0

Views: 237

Answers (1)

mipadi
mipadi

Reputation: 410582

Your directory structure is wrong. en.lproj, etc., should contain a directory called atlases, like this:

<bundle root>
|-- en.lproj
|---- atlases
|------ test-hd.plist
|-- es.lproj
|---- atlases
\------ test-hd.plist

Upvotes: 1

Related Questions