Daniel Dan - 2013-11-12

In VCL 1.1 we introduce the #adapt-copy command. #adapt-copy can be used for copying the content of a file in the output, or to copy a file in a given destination (this option can copy binary files too).

The #adapt-copy commands:

  • #adapt-copy <expression> (where <expression> leads to file's relative or absolute path)
    • The processor copies the file's content in the current output file without executing any commands or evaluating any expressions inside it (without touching it's content).
  • #adapt-copy <expression1> <expression2> (where <expression(i)> leads to file's relative or absolute path)
    • The processor copies the <expression1> file's content into file <expression2> without executing any commands or evaluating any expressions inside it. With this command the output of the processor won't change, and in the second file will contain nothing but the first file's content.
      So when the copy is done the output is the same as before.

Example 1:

We want to copy some settings from settings.xml in our output:

settings.xml

This is the file we want to have in our
output without evaluating anything any
commands in it.

SPC.vcl

% some VCL content
---- copy starts here ----
#adapt-copy "settings.xml"
---- copy ends here ----
% some VCL content

output

---- copy starts here ----
This is the file we want to have in our
output without evaluating anything any
commands in it.
---- copy ends here ----

Example 2:

We want to copy "orig.zip" file in our output folder.

SPC.vcl

% some VCL content
---- copy starts here ----
#adapt-copy "orig.zip" "myCopy.zip"
---- copy ends here ----
% some VCL content

output

---- copy starts here ----
---- copy ends here ----

File copied to the output folder with name myCopy.zip

Relative path of the first file is starting from the adapt's relative path (currently processed file's folder).
Relative path of the second file is starting from the output's relative path (outdir).

For relative path handling information please refer to relative path info.

Example 3:

SPC.vcl

#outdir "outFolder"
% some VCL content
---- copy starts here ----
#adapt-copy "orig.zip" "orig.zip"
---- copy ends here ----
% some VCL content

First orig.zip is in the SPC.vcl's folder,
second (our) orig.zip will be in outFolder.