0

I need to install a specific file only if the user does a new installation. If the user does an update of an existing installation, the file should not be installed.

Is this possible with InnoSetup?

TIA Michael

Inno Setup: How to overwrite on install but not on change? doesn't help in my case, because it is possible that the user sets a new target folder. Setting a new target folder should be handled as a new installation.

So is it possible to detect that there is already an exe in the target folder?

Problem solved:

Source: "build\Install_files\First.ver"; Flags: onlyifdoesntexist; DestDir: "{app}"; Check: not MyFileExists(ExpandConstant('{#MyExe}'))


[Code]
{prueft, ob eine Datei schon im Ziel existiert. Pfadinformationen werden entfernt.}
function MyFileExists(const FileName: String): Boolean;
var 
   name: string;
begin
   name := ExtractFileName(FileName);
   FileName := ExpandConstant('{app}\') + name;
   Result := FileExists(FileName);
end;
MTR
  • 1,690
  • 3
  • 20
  • 47
  • So do you want to install some file only if some **other** file is not present in the target folder? – Martin Prikryl May 03 '22 at 09:00
  • There's no point calling `ExpandConstant` on `'{#MyExe}'`. There's no constant to expand. The `{#MyExe}` is an inline preprocessor directive, not a constant. – Martin Prikryl May 18 '22 at 18:43

0 Answers0