templates/windows/installer: Add command line flag for portable installation

Users of the Installer can now specify the `/Portable` flag in addition to other flags to install as Portable.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2022-09-19 23:40:50 +02:00
parent 761f741c56
commit df12d2fb80

View file

@ -154,6 +154,24 @@ begin
PAnsiChar(S), SMTO_ABORTIFHUNG, 5000, MsgResult);
end;
// ------------------------------------------------------------------------------------------------------------------ //
function ParamExists(Name: String): Boolean;
var
Idx: Integer;
Limit: Integer;
Param: String;
begin
Limit := ParamCount()
for Idx := 1 to Limit do begin
Param := ParamStr(Idx);
if SameText(Param, '/' + Name) then begin
Result := True;
exit;
end;
end;
Result := False;
end;
// ------------------------------------------------------------------------------------------------------------------ //
var
oModePageSystemChoice: TNewRadioButton;
@ -196,9 +214,15 @@ procedure OnModePageSystemChoiceClick(Sender: TObject); forward;
// ------------------------------------------------------------------------------------------------------------------ //
function InitializeSetup(): Boolean;
begin
if ParamExists('Portable') then begin
bIsSystemMode := False;
bIsUserMode := False;
bIsPortableMode := True;
end else begin
bIsSystemMode := IsAdmin();
bIsUsermode := not IsAdmin();
bIsUserMode := not IsAdmin();
bIsPortableMode := False;
end;
Result := True;
end;