Custom Project Builder Templates
Wednesday, September 24th, 2003 @ 7:28 pm | Programming
The standard response is to change one of the hidden user defaults for Project Builder. But did you know you can easily customize the file and project templates used by Project Builder?
Chris goes on to discuss creating file templates for his open source work.
I was looking at file templates last week and I think it’s cool that creating a new template is so simple. However, I’ve this far been thwarted in my attempts to create a template for Objective-C categories. It just doesn’t seem like there’s any way to split the file name into the class name and extension name.
September 24th, 2003 at 9:59 pm
Sounds like a job for a BBEdit glossary item. 🙂
September 25th, 2003 at 1:53 am
How so? When I write categories, my files are usually named ObjCClass-ExtName.(c|h). I think the BBEdit Glossary would have the same problem as the Project Builder templates — the glossary can’t parse the file name to separate the class and extension names.
Of course, you could create a glossary entry that created a took text in the format of “ObjCClass (ExtName)” and populate the file from that, but then you’d need two variations (.h and .m files) and you’d have to add the file to your project by hand.
I just don’t see a way to automate the process as nicely as can be done for Objective-C classes.
Maybe I should just create a template that leaves space for me to enter the class and extension names by hand…
September 25th, 2003 at 9:43 pm
I was thinking that the glossary entry could use AppleScript to do the parsing. I think you’re right about adding the files to the project, though.
November 11th, 2003 at 6:39 am
In PB try using the macro
FILEBASENAMEASIDENTIFIER
which uses the filename minus extension, and ensures that it is a legal C identifier.
November 11th, 2003 at 9:00 pm
But if the file name is NSSString-EBExtensions.h, that doesn’t help me separate the “NSString” and “EBExtensions” strings.