6

Previously all file headers were being displayed as follows.

//  Created by ABC_User_Name on 10/31/11.

I have modified user name from ABC_User_Name to XYZ_User_Name.

Now, even after logging out & logging in again, I am finding the same headers in all project templates. How to update those templates with current user-name ?

Do I need to modify manually all of them ?

halfer
  • 19,824
  • 17
  • 99
  • 186
sagarkothari
  • 24,520
  • 50
  • 165
  • 235
  • 1
    you should refer these answers http://stackoverflow.com/questions/33720/change-templates-in-xcode – Maulik Oct 31 '11 at 08:46
  • Those paths are obsolete I'm afraid. Now Developer is at ~/Library/Developer. – Jano Oct 31 '11 at 08:57
  • 1
    @sugar : also refer this http://stackoverflow.com/questions/2956464/where-do-i-set-my-company-name – Maulik Oct 31 '11 at 09:38
  • Note that the Xcode 4 working answer of the link above is http://stackoverflow.com/questions/2956464/where-do-i-set-my-company-name/7377779#7377779 The accepted answer mentions using PBXCustomTemplateMacroDefinitions, which doesn't work anymore. – Jano Oct 31 '11 at 11:22

2 Answers2

4

The original templates use this header:

//  Created by ___FULLUSERNAME___.
//  Copyright ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.

The words with the double underscore are placeholder references. There are 18 that I know of, and you can add more in your template definition. These options can be further modified using option variables. The ones you see above are:

  • ___FULLUSERNAME___ Full user name of the current user (name + surname).
  • __YEAR__ Current year.
  • ___ORGANIZATIONNAME___ The name of your organization as seen on your address book. You can change it for each project selecting the Project node and setting the Organization field.

Once the project is created, the header becomes plain text and is never updated.


For future projects I suggest you duplicate the templates and do the changes there. Otherwise you risk screwing up the original templates or having Xcode overwrite your changes.

The originals are at:

/Developer/Library/Xcode/Templates/
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates 

And I made a copy at:

mkdir -p ~/Library/Developer/Xcode/Templates/File\ Templates/Jano
mkdir -p ~/Library/Developer/Xcode/Templates/Project\ Templates/Jano

where "Jano" is my user and it will show as a template category in the new project selection screen.

User templates

Then you edit the header manually file by file, or from bash using sed.

Jano
  • 62,815
  • 21
  • 164
  • 192
4

Xcode 4 stores this on a per-project basis.

If you select the project in the Project Navigator (Cmd-1) and open the File Inspector (Cmd-Opt-1), you'll see a field for "Organization" under "Project Document".

Maulik
  • 19,348
  • 14
  • 82
  • 137