Inno Setup Check if file exist in selected destination location

Viewed 1678

I have created files for a program I want to make as an update.
I would like it, before the installation, to check whether the program is also in the standard directory, and if not the one itself the right directory can choose where the program is.

I have tried this:

[Files]
Source: "C:\Data"; DestDir: "{app}"; Flags: ignoreversion

[Code]
function NextButtonClick(PageId: Integer): Boolean;
begin
    Result := True;
    if (PageId = wpSelectDir) and not FileExists(ExpandConstant('C:\Program\Test\Test.exe')) then begin
        MsgBox('YourApp does not seem to be installed in that folder.  Please select the correct folder.', mbError, MB_OK);
        Result := False;
        exit;
    end;
end;

But during the installation it does not check it.
Whether the program is available or not, it installs it anyway.

I hope someone can help me.

1 Answers
Related