Is there a function or preprocessor directive that can be used to add multiple lines to the Files section in Inno Setup? For example, I have numerous occurrences of a pattern similar to the following:
[Files]
Source: "{#SrcPath}\Dir1\FileName.*"; DestDir: {#DstPath}\Dir1;
Source: "{#SrcPath}\Dir2\FileName.*"; DestDir: {#DstPath}\Dir2;
Source: "{#SrcPath}\Dir3\FileName\*"; DestDir: {#DstPath}\Dir3\FileName; Flags: recursesubdirs
And while I can just copy and paste the lines for each one, I was wondering if instead I could do something like this?
[Files]
AddFiles(FileName)
Unfortunately, I can't find any examples in the docs or online that illustrates how to do this. Is this possible?
Define a preprocessor macro (template) using the
#define
directive like this:And expand the template using the
#emit
directive like this:If you get the preprocessor to dump a preprocessed file, you will see that the code produces this:
Implementation notes: I didn't find a way to emit a new-line in the default Pascal-style preprocessor strings, so I had to temporarily switch to C-style strings using the
#pragma parseroption -p-
.I have posted a follow-up question:
Emit new line in Inno Setup proprocessor