2
votes

I am really struggling with this one. I have an entry in the files section of an Inno Setup (5.5.9) configuration file, that is something like the following:

[Code]
procedure showMsgBoxOfFile;
begin
  MsgBox(ExpandConstant(CurrentFilename), mbInformation, MB_OK);
end;
[Files]
Source: {src}\Some\Path\myFile*Pattern.ext; DestDir: {app}; Flags: external; \
    AfterInstall: showMsgBoxOfFile;

When I run the installer generated by running the above script, I get a single message box with the {app} directory, even though four files are copied. This seems to be in direct contradiction of the Inno Setup documentation on BeforeInstall/AfterInstall, which states:

A BeforeInstall or AfterInstall function for a [Files] section entry using a wildcard is called once per file matching the wildcard. Use CurrentFileName to check for which file the function is called.

Further, another question on Stack Overflow is from a user who wanted to do the exact opposite (get only one notification when multiple files were changed). The accepted answer to that question indicates that:

there is no way to call [AfterInstall] once after all the files are installed

I noticed that if I remove the "external" flag from my file copy, I DO get one message box per file. Is there a way to get a one notification per copied file when the "external" flag is specified? Does anyone know if there is a plan to document this difference in the Inno Setup help files?

1

1 Answers

1
votes

Indeed, for entries with the external flag, the BeforeInstall and AnswerInstall functions are called only once.

What you can do, is to copy the files programmatically. It would give you a full control over, what you do for each file.

See Inno Setup: copy folder, subfolders and files recursively in Code section