Alexander Surkov
Alexander Surkov

Reputation: 1711

Inno Setup - How to get the path of the current copied file from Files section

I have .iss script with the following code:

[Files]
Source: "..\*.ext"; DestDir: "{tmp}\Test\"; \
   AfterInstall: DoSomething('{path}'); Flags: ignoreversion recursesubdirs createallsubdirs;

[Code]

procedure DoSomething(path: string)
...
end;

I need to call the procedure DoSomething() and pass to it the path of the current copied file for every file. How can I get the path of the current file from the [Files] section?

Upvotes: 4

Views: 577

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202138

Quoting the documentation of the AfterInstall parameter:

Use CurrentFilename to check for which file the function is called.

(link added by me)


[Files]
Source: "..\*.ext"; DestDir: "{tmp}\Test\"; \
   AfterInstall: DoSomething; Flags: ignoreversion recursesubdirs createallsubdirs;

[Code]

procedure DoSomething;
var
  Path: string;
begin
  Path := CurrentFilename;
  { ... }
end;

Upvotes: 1

Related Questions