• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
subfolders in Resource Bundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: subfolders in Resource Bundle
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Half-height lines?
  • Next by Date: Re: subfolders in Resource Bundle
  • Previous by thread: Re: Half-height lines?
  • Next by thread: Re: subfolders in Resource Bundle
  • Index(es):
    • Date
    • Thread