• 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: Project templates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Project templates


  • Subject: Re: Project templates
  • From: Jason Stephenson <email@hidden>
  • Date: Tue, 24 Jun 2008 20:56:30 -0400

Karan, Cem (Civ, ARL/CISD) wrote:
While I'm at it... how do I prevent new Xcode installs from
clobbering my carefully crafted file/project templates?  Everytime I
upgrade, I waste about half day adding my templates back in (and I
usually miss a few in the process)


I recently discovered that Xcode won't pick up my customized verions of the default templates from my ~/Library... directory when the actual Xcode templates are installed in the /Developer directory. I have some customizations that I make to the source files (mostly Objective-C .h files) and was a bit disappointed after copying the project and file templates and made my changes, only to discover that after starting Xcode and creating new files and projects, my changes were not picked up.--I suppose it might work if I rename the templates, but didn't think of renaming the templates until later.


Anyway, I decided to modify the template files in place in the /Developer hierarchy. To "future proof" my changes, I put my changes into a sed command file. So, when I upgrade Xcode and it overwrites the templates, I can run my sed commands again. Since the sed commands all trigger on regexps, they should still work, even if things are moved/removed from the templates in the future. Oh, and I do have sed keep a backup copy of the original file so I can revert to it if my changes break anything.

In fact, the changes that my sed script makes are very minor. It moves the { on the end of @interface... lines to the line below the @interface. (If its not on the end of the @interface line, then nothing happens.) It also adds a specially-formatted comment to the top of the .h files. This comment instructs my editor (GNU Emacs) to handle the file in Objective-C mode instead of C mode. This way I don't have to manually switch the mode when editing these .h files.

Anyway, if you want to automate your changes, you could look into using sed. It works pretty well on UTF-8 files as long as what you're changing is plain ASCII, or you take care with multi-byte sequences.

HtH,
Jason
_______________________________________________
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: Project templates
      • From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>
    • Re: Project templates
      • From: Scott Tooker <email@hidden>
References: 
 >Project templates (From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>)

  • Prev by Date: RE: Project templates
  • Next by Date: Re: Project templates
  • Previous by thread: Re: Project templates
  • Next by thread: Re: Project templates
  • Index(es):
    • Date
    • Thread