Skip to content

Commit

Permalink
templates/windows/installer: Don't offer path selection for System & …
Browse files Browse the repository at this point in the history
…User mode

The location for System-wide and User-only installation depend on Windows-managed locations, which means that they will never require a user to select the correct location. Therefore it is best to hide the page in all modes except for Portable, which should still offer a path to extract to.
  • Loading branch information
Xaymar committed Sep 19, 2022
1 parent b42d488 commit 568a86b
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions templates/windows/installer.iss.in
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if (PageID = wpSelectDir) then begin
Result := not IsPortableMode();
end;
end;

// ------------------------------------------------------------------------------------------------------------------ //
Expand Down Expand Up @@ -220,27 +223,21 @@ function GetDefaultDirectory(Value: String): String;
var
sPath: String;
begin
// If a path was given as an argument, use it.
if (Value <> '') then begin
Result := Value;
exit;
end;

// Otherwise, try and figure out where the previous installation of the same type went to.
if (RegQueryStringValue(HKA64, AppRegistryKey(), 'InstallLocation', sPath)) then begin
Result := sPath;
exit;
end;

// In all other cases, change depending on the chosen install method.
if (IsSystemMode()) then begin
// Default to ProgramData/obs-studio/@PROJECT_NAME@
Result := ExpandConstant('{commonappdata}\obs-studio\plugins\@PROJECT_NAME@');
end else begin
Result := ExpandConstant('{userpf}\obs-studio\plugins\@PROJECT_NAME@')
end;
end else if (IsUserMode()) then begin
Result := ExpandConstant('{userpf}\obs-studio\plugins\@PROJECT_NAME@');
end else begin
// If a path was given as an argument, use it.
if (Value <> '') then begin
Result := Value;
exit;
end;

exit;
Result := ExpandConstant('{userdesktop}\obs-studio');
end;
end;

// ------------------------------------------------------------------------------------------------------------------ //
Expand Down

0 comments on commit 568a86b

Please # to comment.