Skip to content

Commit

Permalink
templates/windows/installer: Add command line flag for portable insta…
Browse files Browse the repository at this point in the history
…llation

Users of the Installer can now specify the `/Portable` flag in addition to other flags to install as Portable.
  • Loading branch information
Xaymar committed Sep 20, 2022
1 parent 18bc6c9 commit fbc95fb
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions templates/windows/installer.iss.in
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -196,9 +214,15 @@ procedure OnModePageSystemChoiceClick(Sender: TObject); forward;
// ------------------------------------------------------------------------------------------------------------------ //
function InitializeSetup(): Boolean;
begin
bIsSystemMode := IsAdmin();
bIsUsermode := not IsAdmin();
bIsPortableMode := False;
if ParamExists('Portable') then begin
bIsSystemMode := False;
bIsUserMode := False;
bIsPortableMode := True;
end else begin
bIsSystemMode := IsAdmin();
bIsUserMode := not IsAdmin();
bIsPortableMode := False;
end;

Result := True;
end;
Expand Down

0 comments on commit fbc95fb

Please # to comment.