Saurabh
Saurabh

Reputation: 799

How do I use "code" in Inno Setup's [Files] section?

I want to dynamically derive the source folder (and destination folder) for 32/64 bit installations. So how can I specify that in the [Files] section of Inno setup. The following gives a compilation error:->

[Files]
Source: {#MySourcePath}\{code:GetSourceLibFolder}\*.jar; DestDir: {code:GetAppDir}\lib\; 

I have the GetSourceLibFolder() and GetAppDir() function defined in the code section. The functions are very simple and just return a variable:

function GetSourceLibFolder(Param: String): String;
begin
  Result:= SourceLibFolder;
end;

function GetSourceBinFolder(Param: String): String;
begin
  Result:= SourceBinFolder;
end;

Thanks !

Upvotes: 13

Views: 15715

Answers (1)

Deanna
Deanna

Reputation: 24253

The source path needs to be used at compile time (unless you have the external flag) which means you must use ISPP and a #define. The [Code] section is only for run/install time code so will work for the target path.

If you provide the code for your GetSourceLibFolder function, someone can convert it to ISPP.

Upvotes: 7

Related Questions