Anyway to get the filename of the template source code filename from inside the templates?

Does anyone know of a template symbol that can give you the filename of the template source code that is being executed, abit like %EditFilename but not %EditFilename?

At this stage, I’m just thinking I might just use
or at the top of every tpl & tpw I might make line 1 something like
#! MyFilename.tpw
and then has some template code to read line 1 automatically, but that still needs updating manually if the filename changes, unless I come up with something to automatically add or update the filename stored inside the template, which runs periodically or is event driven.


Why do you want the filename?

Fwiw I use AssertHook2 to get the filename ( and line number) as part of a call to OutputDebugString

Note assert only works in debug builds
Or with pragma asserts=>on

To make sure the right template file is being used. If the Registry is set to ReadOnly, changes to a template file which is sending messages to debugview wont be updated.

I tend to have multiple instances of the IDE open so its a check for that scenario amongst a few others.

Oh I misunderstood
I thought you wanted to know what file was being generated

Not which templates are being used to do the generation.

Note you can turn generation logging on
Warning this will slow generation down greatly

Yeah but its not detailed enough which is why I’ve gone down this route for getting the templates to generate messages for debugview.