• 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
Re: subfolders in Resource Bundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >subfolders in Resource Bundle (From: "Harold Putman" <email@hidden>)

  • Prev by Date: subfolders in Resource Bundle
  • Next by Date: Re: 'real' auto wrap in NSTextView
  • Previous by thread: subfolders in Resource Bundle
  • Next by thread: NYC Cocoaheads meeting
  • Index(es):
    • Date
    • Thread