Re: Xcode WO template (Xcode 2.2, WO 5.3)
Re: Xcode WO template (Xcode 2.2, WO 5.3)
- Subject: Re: Xcode WO template (Xcode 2.2, WO 5.3)
- From: Francis Labrie <email@hidden>
- Date: Wed, 11 Jan 2006 08:48:07 -0500
Hi,
Xavier wrote:
I've checked the provided templates and I have «DATE» in everyones!?
I've also made sure I've got the same header than the default one (like Application.java) and it seems correct.
Maybe I should reindex something?
Anyway, just to make sure, I've tried your suggestion and it didn't work.
Welcome to HUWAT (Hidden and Undocumented World of Apple Tools)...
First of all, check at the "
TemplateInfo.plist" file in each template. This XML or NeXT property list file describes the template, the parsing and copying task. I don't know if Xcode 2.x fix this bug, but you should keep this file encoded to "
MacRoman" if you uses the variable placeholder (
«») or any foreign characters.
Below are two examples of a "
TemplateInfo.plist" for a project template: these are kept hidden in the "
*.xcode" project folder:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="1.0">
<dict>
</key>
<array>
</string>
</string>
</string>
</string>
<string>Enterprise Objects/EOJavaClass.template</string>
<string>Web Components/Main.java</string>
<string>Web Components/Main.wo/Main.html</string>
</array>
</key>
<string>Creates a WebObjects application customized for...</string>
</dict>
</plist>
{
FilesToRename = {
"Classes/Startup.java" = "Classes/«PROJECTNAME».java";
};
FilesToMacroExpand = (
"Classes/package.html",
"Classes/«PROJECTNAME».java",
"Documentation/overview.html",
"Documentation/README",
"Enterprise Objects/JavaClassSource.eotemplate",
"Enterprise Objects/JavaSubclassSource.eotemplate"
);
Description = "Creates a reusable framework customized for...";
}
You can easily figure the tasks performed by both "
FilesToRename" and "
FilesToMacroExpand" fields. Below are two examples of a "
TemplateInfo.plist" for a file template: these are kept hidden in the "
*.xcode" project folder:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</key>
<string>Class file for..</string>
</key>
</string>
</dict>
</plist>
{
Description = "Class file for...";
MainTemplateFile = "class.java";
}
Finally, you must make sure the variable placeholders (
«») in your expanded files are encoded in "
MacRoman". This is very important: Xcode parse the file as byte stream and match placeholder as the byte value of both
« and
» characters.
So you can expand variables in files encoded with another characters set like
UTF-8 or
ISO-8859-1, but you should take care of placeholders:
«» characters doesn't have the same byte value and numbre in
UTF-8 or in
ISO-8859-1.
The easier way to create templates with files encoded with a characters set other than "
MacRoman" is to create temporary files with ASCII escape sequences for the placeholder,
i.e. "
__<<__" for "
«" and "
__>>__" for "
»". When your file is ready to be packaged in a template, you use a "
MacRoman"
Bourne Shell script to substitute the escape sequences:
#!/bin/sh
while [ "${1}" != "" ] ; do
sed s/'__<<__'/g "${1}" > "${1}~" && mv "${1}~" "${1}"
sed s/'__>>__'/g "${1}" > "${1}~" && mv "${1}~" "${1}"
shift
done
exit 0
Kind regards,
--
<x-tad-bigger>Francis Labrie</x-tad-bigger>
Saint-Bruno-de-Montarville, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden