Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

templates/windows/installer: Implement /Portable installer flag for CLI users #935

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions templates/windows/installer.iss.in
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,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 @@ -190,9 +208,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