I have an Ant script to compile a Java program (the one I want to distribute), create a few different executables and settings files (to run different configurations), and then launch an Inno Setup script to put it all together into an installer. The Ant script has many properties defined (mostly pathnames and filenames) that get passed to the Inno Setup script as constants.
I have one user who needs a special executable. Rather than maintain two different Ant scripts, it was easy to have the Ant script always create the executable. But I also set a property field (fullJRE
) to either 0 or 1 depending on if the executable is needed or not needed. The property gets passed to Inno Setup as a constant and is then used in the [code] section to keep/delete the file at the end. The function to do this is called from the CurStepChanged
procedure, using CurStep=ssPostInstall
:
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssPostInstall then
begin
updateINI();
end
end;
function updateINI(): boolean;
begin
if ({#fullJRE} = 0) then
begin
DeleteFile(ExpandConstant('{app}\{#launcherName}.exe'));
end;
end;
But a shortcut to the executable is being created in the Icons section of the script, because when [icons] is run the file still exists. Based on the fullJRE
constant, I either need to keep both the file and the shortcut or delete them both.
Is there a way I can either:
- add an 'if' statement to the
Icons
section to prevent certain icons from being created - delete the extra shortcuts at the end of the install, when I delete the files
Any help would be appreciated. Thanks so much!