Different Delphi versions (in my case 2007, XE and XE2) seem to use the same code-template repository, such as ..\Documents\RAD Studio\code_templates
. Since XE2 uses namespaced units, this causes problems when one have to use a unit name in a template.
For instance I have a template when I write winbeep
which completes to windows.Beep(300, 100);
and selects and stops on frequency etc.. This does not compile on XE2 unless I remove the Winapi.
part of the Windows
unit in the uses clause (or of course add the prefix manually). I have to have the unit name because otherwise SysUtils.Beep
gets referred.
I couldn't find an option entry or a registry key or an environment variable specifying the place of the templates. It is not even related to BDSUSERDIR
, in fact I don't even have a directory in my computer having the path of BDSUSERDIR
(which is ..\Documents\RAD Studio\9.0
). Is this my oversight and in fact there's an option to relocate code templates? If not, is it possible to make the IDE use unit aliases in uses clause for new forms?
edit:
Here it is stated that (emphasis by me) "Templates that you create (and templates provided by third party add-ins) are saved by default in the \My Documents\RAD Studio\code templates\ directory." That would imply there should be way to save them in a non-default place. But the article does not mention how.