Wrapping an existing tag with additional functionality?

In ACF I have previously ‘wrapped’ the internal <cffile> tag with my own code, eg

cfm files use <cffile blah blah> (but <cffile> is now my tag)

my <cffile> implementation calls <cffileInt> - which is the original java class representing the <cffile> renamed in the tld file to <cffileInt>

Why? so I could do something tricky with file paths on a live system while a large number of files were being moved, without touching a single file in the application code base.

How might I approach this in Lucee?

Why do you want to subvert the normal operation of <cffile>? If you are writing your own underlying implementation why not a straight up class file or your own <cf_myfile> or a CFC for that matter?

Don’t want to change all the code, call me lazy :wink: even if it is just a
global search and replace

The other way to do this is to have a ResourceProvider, so for example we have resource providers for a mapping, that means you can use a DB just as you would a file system with the <cffile> tags.

This would mean you don’t have to change much (I don’t know your code) but create a mapping and then perform normal CFFile actions on that mapping that is implemented by your resource provider to do your custom things.

Another way to do this of course, is to create your own cffile tag and deploy it as an extension (so you can add and remove it) which basically puts a .cfc based custom tag in /express/lib/ext/lucee-server/context/library/tag that would (or rather should?) override the default cffile for that server.

Thanks interesting idea. Ok wondered whether I could override, but then
would have no easy way of using the built in tag would i

You could still use the built-in File functions just fine from within your own cffile tag.

Good ideas