问题
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.
回答1:
Use DirExists(ExpandConstant('{app}'))
to check for an existence of the selected directory.
来源:https://stackoverflow.com/questions/55721409/inno-setup-install-only-on-a-non-existent-directory