How to use placeholder like {app} or {temp} in Inn

2019-02-19 00:01发布

问题:

How can I access (directory) constants from Inno Setup script code ?

I have tried the following without success:

function dbExistis() : Boolean;
begin
  Result := FileExists({commonappdata} + '\LR-International\DB_LR.IB');
end;

回答1:

Use ExpandConstant function

function dbExistis() : Boolean;
  begin
    Result := FileExists(ExpandConstant('{commonappdata}') + '\LR-International\DB_LR.IB');
  end;


回答2:

Use the ExpandConstant function to expand any of the constants value:

function dbExistis: Boolean;
begin
  Result := FileExists(ExpandConstant('{commonappdata}\LR-International\DB_LR.IB'));
end;


标签: inno-setup