inno-setuppascalscriptistool

How to dynamically add files to the Inno Setup installation?


Is there a way to dynamically fill the [Dirs] and [Files] sections of an Inno Setup script?

Here is what I am trying to do:

  1. during the install process, the user will select foo (foo matches a repository to get from our SCM)

  2. Setup will run a batch to checkout foo from our SCM

  3. then the content of foo must be added to the [Dirs] and [Files] sections of the script

Everything works fine except for the last step. I searched around and couldn't find explanations on how to do this. I have the feeling that my script should embed all the repositories of our SCM to then be able to copy only the selected ones to the destination directory.

Thanks for your help!

Regards,


Solution

  • See Prompt for external file location in Inno Setup.

    And add the recursesubdirs flag.

    You may also need the createallsubdirs flag (assuming from your reference to the [Dirs] section).

    [Files]
    Source: "{code:GetScmPath}"; DestDir: "{app}"; \
        Flags: external recursesubdirs createallsubdirs
    
    [Code]
    
    function GetScmPath(Param: string): string;
    begin
      Result := // make it return path to the checked out files
    end;