• 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: Other option rather than .rsrc in Xcode...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Other option rather than .rsrc in Xcode...


  • Subject: Re: Other option rather than .rsrc in Xcode...
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Wed, 17 Dec 2008 23:55:17 +0100


Le 17 déc. 08 à 23:40, Nima a écrit :




On Wed, Dec 17, 2008 at 3:40 PM, Chris Espinosa <email@hidden> wrote:
On Dec 17, 2008, at 11:36 AM, Nima <email@hidden> wrote:

Hello everyone,

I have a _javascript_ file that I want to include in my Xcode but for some reason, not as a separate file in project, I need something like a string that could contain entire script file( like STR in .rsrc) but don't want to include .rsrc file in my Xcode project.
I wonder what would be the best approach to do that? and how to retrieve the content of script(string) at runtime?

I use C/C++, OS X 10.5.5

You could of course just put it in a large constant string, or take advantage of C's automatic concatenation of consecutive string literals:

char * myScript = "function inDate() {\n"
                              s=prompt(\"input date:\");\n"

Etc.

The maintenance of the newlines and escaping of the quotes is a pain, but if this is a one-time thing you can do it with find and replace.

Chris

Thanks Chris,
 I wish there was a better approach as you mentioned the maintenance is not an easy thing to do.

Nima
 

I think the recommended approach is to put the _javascript_ file in the Bundle resources, and read it at runtime using NSString or CFString functions. (and bundle api to locate it)
Is there a good reason you don't want to add the script in a separate file ? 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Other option rather than .rsrc in Xcode... (From: Nima <email@hidden>)
 >Re: Other option rather than .rsrc in Xcode... (From: Chris Espinosa <email@hidden>)
 >Re: Other option rather than .rsrc in Xcode... (From: Nima <email@hidden>)

  • Prev by Date: Re: Other option rather than .rsrc in Xcode...
  • Next by Date: Re: Other option rather than .rsrc in Xcode...
  • Previous by thread: Re: Other option rather than .rsrc in Xcode...
  • Next by thread: Re: Other option rather than .rsrc in Xcode...
  • Index(es):
    • Date
    • Thread