Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Inno Setup to set the installation folder dynamically

I am creating an installation package and user should be able to install it on a specific location only.

In order to do so I read some registry values in the [Code] section to determine the installation path.

Having the installation path I need to force Inno Setup to set the installation folder to a specific location at run-time.

Is this possible in Inno Setup? Which section of script should be used if so?

Thanks.

like image 671
LastManStanding Avatar asked Sep 12 '16 19:09

LastManStanding


1 Answers

  • Use a scripted constant to set the default installation path;
  • Use the DisableDirPage directive to prevent an user from modifying it.
[Setup]
DefaultDirName={code:GetDefaultDirName}
DisableDirPage=Yes

[Code]

function GetDefaultDirName(Param: string): string;
begin
  Result := ...;
end;
like image 196
Martin Prikryl Avatar answered Oct 21 '22 07:10

Martin Prikryl