subfolders in Resource Bundle
subfolders in Resource Bundle
- Subject: subfolders in Resource Bundle
- From: "Harold Putman" <email@hidden>
- Date: Mon, 16 Jul 2007 13:53:30 -0400
I am bundling HTML files in a Cocoa application and I want to preserve a
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"]];
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL
fileURLWithPath:fullPath]]];
When I put the HTML file in the Resources folder, (no subfolder), I can load
it fine using...
NSString *fullPath = [bundle pathForResource:@"file1" ofType:@"html"
inDirectory:path];
But I cannot seem to find a way to load the HTML file from a subfolder of
Resources. I have read some articles on this list about a similar problem
loading images from a subfolder, but I cannot find a resolution.
Does anyone know how to do this?
Thanks,
Harold
_______________________________________________
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