Inno Setup,仅安装在不存在的目录中

问题描述 投票:1回答:1

我想不允许在现有目录或至少非空目录上安装。

现在我正在使用这种解决方法来检查程序是否安装在用户选择的目录中,但如果它是未安装程序的目录或非空程序,则不起作用。

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;

我有DirExistsWarning=yes指令,但这还不够。

谢谢您的帮助。

windows installer inno-setup pascalscript
1个回答
1
投票

使用DirExists(ExpandConstant('{app}'))检查是否存在所选目录。

© www.soinside.com 2019 - 2024. All rights reserved.