RE: Project templates
RE: Project templates
- Subject: RE: Project templates
- From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>
- Date: Wed, 25 Jun 2008 07:19:13 -0400
- Thread-topic: Project templates
I hadn't thought about sed... and IIRC diff will output an ed script, right? The easiest way may be to copy the templates somewhere, run diff to get the ed script, and save that somewhere...
Thanks,
Cem Karan
-----Original Message-----
From: Jason Stephenson [mailto:email@hidden]
Sent: Tuesday, June 24, 2008 8:57 PM
To: Karan, Cem (Civ, ARL/CISD)
Cc: email@hidden
Subject: Re: Project templates
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