• 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: Scott Tooker <email@hidden>
  • Date: Tue, 24 Jun 2008 18:40:05 -0700


On Jun 24, 2008, at 5:56 PM, Jason Stephenson wrote:

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.

Ugh. Don't do this (modifying the shipping template files in place). Xcode supports pulling in addition files from well known locations, including inside the user's Library folder.


It's possible you were bitten by these locations being changed in Xcode 3.0 to support side-by-side installation of the tools. Check out the Xcode 3.0 release notes for more information.

If not, you do raise an interesting case of having custom project/file templates with the same name. I'd argue that it sounds like a bug in Xcode with respect to the order that the various "domains" are searched. If that is really what is going on, please file a bug.

Scott



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

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

  • Prev by Date: Re: Project templates
  • Next by Date: How do I use multiple targets in a project?
  • Previous by thread: Re: Project templates
  • Next by thread: RE: Project templates
  • Index(es):
    • Date
    • Thread