Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

inno-setup

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 !

like image 592
Saurabh Avatar asked Nov 18 '11 01:11

Saurabh


People also ask

How do I make an inno file executable?

Go to Menu, Project, then Compile to compile and create the setup file. This will create a complete installer. Run the Setup and your application will be installed correctly. Innosetup offers an awesome alternative to create great looking Installers for free.

How do I add a checkbox in Inno?

[Code] procedure ExitProcess(uExitCode: UINT); external '[email protected] stdcall'; var MainPage : TWizardPage; FolderToInstall : TEdit; InstallLocation : String; procedure CancelClick(Sender: TObject); begin if ExitSetupMsgBox then begin ExitProcess(0); end; end; procedure BrowseClick(Sender : TObject); var ...

What is Inno Script Studio?

Inno Script Studio is a new intuitive graphical interface for generating and compiling scripts for the award winning Inno Setup compiler from Jordan Russell.


1 Answers

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.

like image 87
Deanna Avatar answered Oct 20 '22 08:10

Deanna