Inno Setup, install only on a non existent directory

大兔子大兔子 提交于 2020-06-27 03:47:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!