Re: subfolders in Resource Bundle
Re: subfolders in Resource Bundle
- Subject: Re: subfolders in Resource Bundle
- From: Douglas Davidson <email@hidden>
- Date: Mon, 16 Jul 2007 11:00:18 -0700
On Jul 16, 2007, at 10:53 AM, Harold Putman wrote:
particular folder structure for the HTML files. This means I need
to pull
the HTML files from a subfolder under Resources.
I am trying to load the following file from the resource bundle.
myapp.app/Contents/Resources/html/main/file1.html
If I look at the package contents of my app the html file is in the
expected
place, but I can't seem to find it with pathForResource. (It always
returns
nil).
Below is the code I am using.
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [bundle bundlePath];
NSString *fullPath = [bundle pathForResource:@"file1"
ofType:@"html"inDirectory:[path stringByAppendingPathComponent:
@"html/main"]];
You're overdoing it. Try [bundle pathForResource:@"file1"
ofType:@"html" inDirectory:@"html/main"]. The last argument is
supposed to be a relative path from the resources directory to the
directory where your file lives; you should never have to deal with
the bundle's absolute path here.
Douglas Davidson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden