1

I would like to not permit the installation on an existent directory or at least a non-empty one.

Right now I am using this workaround just to check if the program was installed in the directory chosen by the user but this doesn't work if it is a directory where the program was not installed or a non empty one.

function NextButtonClick(PageId: Integer): Boolean;
begin
    Result := True;
    if (PageId = wpSelectDir) and  FileExists(ExpandConstant('{app}\some_app_file')) then
    begin
        MsgBox('Warning message, cannot continue.', mbError, MB_OK);
        Result := False;
        exit;
    end;
end;

I have the DirExistsWarning=yes directive but it's not enough.

Thanks for the help.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
res1
  • 3,482
  • 5
  • 29
  • 50

1 Answers1

1

Use DirExists(ExpandConstant('{app}')) to check for an existence of the selected directory.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992