Wait a minute. I don't have a file.cpp in that
directory (..../Project Templates/Command Line
Utility/C++ Tool).
Okay, we're talking about two different places. I thought you just wanted to make a Javascript file template and you're poking around in the
project templates. I'm not sure what the point of making a project template would be for a Javascript file. There's no real "build" setting, you'd just be using the Xcode text editor. But all your debugging would need to be done with a web browser. So I was talking about looking at the shell script file template that's here:
<pre class="command">/Library/Application Support/Apple/Developer Tools/File Templates/Scripts/Shell Script.pbfiletemplate</pre>That's the template you'd get if you were to choose "New File..." from the "File" menu in Xcode. That's what you'd need to do for a JavaScript file.
For your project templates, it looks like they're laid out a bit differntly. There are three files:
<pre class="command">-rw-rw-r-- 1 root admin 3132 Sep 11 22:03 C++Tool.1
drwxrwxr-x 4 root admin 136 Sep 11 22:03 C++Tool.xcodeproj
-rw-rw-r-- 1 root admin 143 Sep 11 22:03 main.cpp</pre>There, main.cpp is the file. On my system, it doesn't have all the extra stuff. This is all there is:
<pre class="command">#include <iostream>
int main (int argc, char * const argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}</pre>It looks like the project name fill-ins are done are done via another file, the
C++Tool.1 file. That looks like an
mdoc file. I don't know anything about it, but it's just a text file, so you can look at it in any text editor.
Inside the Java Tool folder there is no file named
file.xxx either.
Right, because it's called "
JavaTool.java." When you create a new
project, Xcode assumes you're starting from scratch, so it makes sense to have a
main.cpp file in your project. Or a
JavaTool.java one. The
file templates, however, are set up differently, because Xcode assumes you either don't want a project file, or you're adding your new file to an already existing project.
I tried adding your comments to main.cpp inside the
Command Line/C++ Tool folder, but when I create a new
project, I have the same problem.
At this point, unless you can puzzle out the
C++Tool.1 file, you might be best off to use
Pacifist to extract the default template out of your Xcode installer package. It's $20 shareware, but at some point, you'll be glad you've got it if you do a lot of tinkering with your system.
A page with some good information on the project templates, by the way, is at
cocoadev. Obviously, it's a bit skewed toward the Cocoa user, but you should be able to get some good info off that page.
charlie