I've been trying to edit the source code file templates in Xcode 4.5 (inside app bundle), to achieve this more doxygen-friendly header comment format:
/*!
#file ___FILENAME___
#package ___PROJECTNAME___
#brief
#details
#author ___FULLUSERNAME___ | ___EMAIL___ | ___WEBSITE___
#date ___DATE___
#version
#copyright ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
#section License
*/
At first, I was using the old method of editing the defaults (either by command line or editing the com.apple.Xcode.plist file in Xcode's built in plist editor), but the changes aren't applied - even after restarting Xcode. I hoped to edit ORGANIZATIONNAME, and add my own EMAIL and WEBSITE fields (see code above).
I read somewhere that ORANIZATIONNAME is now entered on the Xcode GUI, on a per-project basis, so I got that one working. But I still wish to expand ___EMAIL___ and ___WEBSITE___, either from preset defaults or (better) from my address book. Is this possible?
Related
I am using WIX Toolset to create MSI Application and I want to provide my own License file to display during the license Agreement on License Agreement Dialog.
I created a new document in word-pad and saved it with .rtf extension. Whatever the content of document wix is not getting build and the error which comes is error LGHT0311.
C:\agent\_work\8\s\src\ext\UIExtension\wixlib\LicenseAgreementDlg.wxs(27,0): error LGHT0311: A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Product/#Codepage, Module/#Codepage, Patch/#Codepage, PatchCreation/#Codepage, or WixLocalization/#Codepage.
Note:- LicenseAgreementDlg.wxs(27,0) contains this line <Text SourceFile="!(wix.WixUILicenseRtf=$(var.licenseRtf))" />
I have tried adding Codepage value as 1252 in Product tag and SummaryCodepage in Package Tag. I have tried even by putting only one character in License file but still getting same error.
Please help me solving this issue?
You need to create your license with WordPad and save it with *.rtf extension.
I was creating the license with Microsoft Office Word, and then saving with *.rtf extension, which was giving error like above.
I'm going to edit my question.
When I want to developer in C++, I go to:
Xcode => New Project => macOS => Command Line Tools => File C++.
When I edit the main.cpp, the content is to defect (with int main(int argc, const char * argv[])....//More code..).
I create a new templates here (To right of Command Line Tools):
enter image description here
Then, I need to create a new project here:
Library/Developer/Xcode/Templates/Project_Templates/name_group = Applications(for_example)/nametemplate.xctemplate /
Here there are several files:
-main.cpp (my template basic c++)
-TemplateIcon.icns (icon of 128 px)
-TemplateInfo.plist : file configured
But this file I don´t know how modify :(
I´ve tryied to put file templateInfo.plist of this directory: Applications/Xcode.app/Content Packets/Contents/Developer/Library/Xcode/Templates / File Templates / C++....
But Xcode don´t recognize, I know that problem is in TemplateInfo.plist but I don´t know how I can modify :(
Now, Do I explained me better?
Thank you!!
I am trying to install two custom "project templates" in Xcode 8.3.3.
To be more specific, I'm trying to install Cocos2D-obj templates for v2.1 and v2.2. (Cocos2D v3 or higher no longer use Xcode templates, but v2.x does.)
During the installation, each Cocos2D v2.1 and v2.2 creates its own Xcode template folders and those folders are simply copied into the Xcode's custom template folder:
~User/Library/Developer/Xcode/Templates/cocos2d v2.2
~User/Library/Developer/Xcode/Templates/cocos2d v2.1
I was hoping to see that there are two separated templates (cocos2d v2.2 and cocos2d v2.1) available in the template menu when a new Xcode project is being created. However only one (either v2.2 or v2.1) appears in the template menu. (Interesting thing is that the last modified one appears.)
Basically it seems like Xcode doesn't allow to have more than one custom template in its menu.
(However, "File template" menu shows both v2.2 and v2.1 "file template" correctly in Xcode, so only the project template doesn't.)
As far as I know this is something related to Xcode's custom template related behavior, but I cannot find any official document regarding custom template from Apple's document depository.
So the question is, how can I have two custom project templates (v2.1 & v2.2) appear in the template menu when new project is being created?
Any good answers or helpful comments are appreciated.
Thanks in advance.
Finally I have figured it out how it goes.
When it comes to "project template", Xcode looks like tracing the "identifier string" in the plist files of each templates. And when there are more than one template files exist under the same "identifier string", it chooses only one template randomly(?) among them and shows that in its template menu when an new project is being created.
After manually modifying those identifier strings from the templates (in v2.1) not to have same ones against templates in other package (v2.2), Xcode brings them all in its template menu correctly. So I manually modified all cocos2d-v2.1 templates not to have same identifier strings against v2.2. Also, it is worth to be noted that some templates have "ancestors" in its fields such that those ancestors are also needed to be updated accordingly when the entire template package is modified for this reason. I wish I could see any official documents from Apple regarding how to handle Xcode's templates, (for the latest version of Xcode).
The file tempates in Xcode 4.5 contain the following in the header
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
How does one set the ___COPYRIGHT___ to a custom value.
Thanks,
Joel
Changing the organization name will help you in set the COPYRIGHT value.
Please look at the screen , (Xcode4.5 screen shot)
When you create a new project in Xcode 4.4 or later, there is an Organization Name text field. The name you enter in the text field goes in the copyright notice, which looks similar to the following:
Copyright (c) 2012 Company Name. All rights reserved.
If you make a mistake entering a company name when creating the project, you can change the company name by selecting the project file from the project navigator and opening the file inspector.
Being able to set the company name is enough customization for most people. If you need to further customize the copyright notice, I recommend making a copy of Apple's file templates, and adding a custom copyright notice to the comments. More information on file templates is available in the following article:
Creating Custom Xcode 4 File Templates
How would I change the initial templates created by Xcode when creating a new Cocoa Class.
I am referring to the comments and class name created when using Xcode's new class wizard.
You wouldn't change the existing templates. In other words, don't modify anything under the /Developer hierarchy (or wherever you installed your developer tools).
Instead, clone the templates you want to have customized variants of. Then change their names and the information in them. Finally, put them in the appropriate location in your account's Library/Application Support folder, specifically:
File templates: ~/Library/Application Support/Developer/Shared/Xcode/File Templates/
Target templates: ~/Library/Application Support/Developer/Shared/Xcode/Target Templates/
Project templates: ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/
That way they won't be overwritten when you install new developer tools, and you can tweak them to your heart's content.
Update
For newer versions of Xcode the updated path will be:
~/Library/Developer/Xcode/Templates/File Templates/Source
This may be useful for somebody:
As for XCode 6 to XCode 9 the file templates are in:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Source
Update:
As #carbo18 noted, it's proably better to create the directory ~/Library/Developer/Xcode/Templates/File Templates/Source and put your custom templates there. The best way may be to use as base one of the ones in /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Source
Xcode uses template files for file and project templates and does variable expansion in both at creation time.
Xcode 3.0 templates can be found in [Dev Installation]/Library/Xcode/, likely /Developer/Library/Xcode. If you want to modify these templates or add your own, use the following directories to save your new/modified templates so that they are not wiped out by future Developer Tool upgrades:
File templates:
~/Library/Developer/Shared/Xcode/File
Templates/
Target templates:
~/Library/Developer/Shared/Xcode/Target
Templates/
Project templates:
~/Library/Developer/Shared/Xcode/Project
Templates/
I think that you can also use the /Library/Developer/Shared/Xcode/[File|Target|Project] Templates/ directory for templates shared by all users.
If you just want to change the MyCompanyName in the templates, the following command line will do the trick:
defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ "ORGANIZATIONNAME" = "NewCompanyName";}'
A good tutorial on writing file templates is here [MacResearch.org].
In Xcode 4 and Xcode 5 the user file templates can be placed at:
~/Library/Developer/Xcode/Templates/[Category]
[Category] can be used to categorize your templates (choose a name of your choise)
If the folder doesn't exist already, create it!
As of Xcode 7
File templates: ~/Library/Developer/Xcode/Templates/File Templates
Project templates: ~/Library/Developer/Xcode/Templates/Project Templates
For example if I place a Empty Application.xctemplate in ~/Library/Developer/Xcode/Templates/Project Templates/Application
It will appear in the template dialog as
In xcode 5.0.1:
1.Go->Applications
2.right click "xcode" application
3.chose "Show Package Contents"
4.contents/Developer/Library/Xcode/Templates
If you are simply looking to change the Author Name and Organization see this answer.
It's much easier than modifying the templates.
For Xcode 4.4, none of the previously mentioned methods work. This gist provides a partial hacky solution. Please fork and enhance if you know a better way.
Right click on xCode and select Show Package contents, then go to contents/Developer/Library/Xcode/Templates. Here you can find the templates for all programming languages.
Here some visualization:
In XCode 4.5 right click on project, click Show File Inspector, then change Organization name in the file inspector's second tab (Project Document group)