使用Inno Setup 5.5.2我试图有条件地跳过选择安装目录,具体取决于路径的存在.具体来说,如果"D:\"驱动器可用,我希望在没有提示的预定义位置安装它,如果它不可用,则提供具有合理默认值的提示.
我有适用于的代码DefaultDirName,但不适用于DisableDirPage:
[Code]
const
DefaultDrive = 'D:\';
AppFolder = 'SomeDir';
function GetDefaultDir( Param: String ) : String;
begin
if DirExists( DefaultDrive ) then begin
Result := DefaultDrive + AppFolder;
end else begin
Result := ExpandConstant('{pf}\') + AppFolder;
end;
end;
function DefaultDirValid( Param: String ) : Boolean;
begin
Result := DirExists( DefaultDrive );
end;
[Setup]
; Works as expected
DefaultDirName={code:GetDefaultDir}
...
; Compiler Error - Value of [Setup] section directive "DisableDirPage" is invalid.
DisableDirPage={code:DefaultDirValid}
Run Code Online (Sandbox Code Playgroud)
我已经尝试使用函数 …