• 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: XCode 2.1 Preprocessing Info.plist
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode 2.1 Preprocessing Info.plist


  • Subject: Re: XCode 2.1 Preprocessing Info.plist
  • From: Dair Grant <email@hidden>
  • Date: Wed, 20 Jul 2005 10:44:08 +0100

Tom Saxton wrote:

>The problem is that the C files want the version number in a
>quoted string and the Info.plist wants it not in a string.
...
>Does someone know a clever trick that will turn an unquoted thing into
>a quoted string, or vice versa?

The approach we use is:

-----------------------
#ifdef INFO_PLIST
    #define STRINGIFY(_x)        _x
#else
    #define STRINGIFY(_x)      # _x
#endif

#define kAppName               STRINGIFY(MyNewApp)
#define kAppVersion            STRINGIFY(1.0a1)
#define kURLHomePage           "http://www.mynewapp.com/";
-----------------------

Where INFO_PLIST is defined in INFOPLIST_PREPROCESSOR_DEFINITIONS. This
will give you the raw MyNewApp token in the .plist, and "MyNewApp" in
your source code.

Note that you can't use STRINGIFY() with all strings - for kURLHomePage,
the presence of the // sequence produces an "unterminated argument list
invoking macro" error.

If you replace it with '/\/' you'll get the correct string in the C
code, but will end up with an extra '\' in the .plist (and similarly for
breaking it into two strings: the C code will merge them, the .plist
won't). For now we just assume this macro is C-only.


One remaining problem (rdar://4177551) is that .strings files can't be
preprocessed, so if your InfoPlist.strings has things like:

-----------------------
CFBundleGetInfoString = "MyNewApp 1.0a1, Copyright Me.";
-----------------------

Then you'll still need to keep that version number in sync manually (in
each of your localised InfoPlist.strings files).


Although invoking the preprocessor is a good step forward, what I would
really like is some kind of dedicated preprocessor as per CodeWarrior.

Ideally without the .plc-style syntax, but something that could:

1. Preprocess .plist and .strings files
2. Automatically de-quote quoted strings in .plist files (but not in
.strings files)
3. Automatically concatenate strings ("foo" "bar" == "foobar")


Olivier Tristan wrote:

>By the way, if you're using gcc 3, you don't have the problem with
>#pragma GCC set_debug_pwd wich is inserted in the first line ?

We use 3.3 for all our projects, and haven't seen this - is it 3.3
you're using, or 3.1?


-dair
___________________________________________________
mailto:email@hidden     http://www.zonic.co.uk/
 _______________________________________________
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

  • Follow-Ups:
    • Re: XCode 2.1 Preprocessing Info.plist
      • From: Olivier Tristan <email@hidden>
  • Prev by Date: huge __LINKEDIT section
  • Next by Date: Re: XCode 2.1 Preprocessing Info.plist
  • Previous by thread: Re: XCode 2.1 Preprocessing Info.plist
  • Next by thread: Re: XCode 2.1 Preprocessing Info.plist
  • Index(es):
    • Date
    • Thread