github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/ci/installers/windows/common.iss (about)

     1  function NeedsAddPath(Param: string): boolean;
     2  var
     3    OrigPath: string;
     4  begin
     5    if IsAdminLoggedOn then
     6    begin
     7      if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
     8        'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
     9        'Path', OrigPath)
    10      then begin
    11        Result := True;
    12        exit;
    13      end;
    14     end
    15    else
    16    begin
    17      if not RegQueryStringValue(HKEY_CURRENT_USER,
    18        'Environment',
    19        'Path', OrigPath)
    20      then begin
    21        Result := True;
    22        exit;
    23      end;
    24    end;
    25    // look for the path with leading and trailing semicolon
    26    // Pos() returns 0 if not found
    27    Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
    28  end;
    29  
    30  var
    31    OptionPage: TInputOptionWizardPage;
    32  
    33  procedure InitializeWizard();
    34  begin
    35    OptionPage :=
    36      CreateInputOptionPage(
    37        wpWelcome,
    38        'Choose installation options', 'Who should this application be installed for?',
    39        'Please select whether you wish to make this software available for all users or just yourself.',
    40        True, False);
    41  
    42    OptionPage.Add('&Anyone who uses this computer (run as administrator to enable)');
    43    OptionPage.Add('&Only for me');
    44  
    45    if IsAdminLoggedOn then
    46    begin
    47      OptionPage.Values[0] := True;
    48    end
    49      else
    50    begin
    51      OptionPage.Values[1] := True;
    52      OptionPage.CheckListBox.ItemEnabled[0] := False;
    53    end;
    54  end;
    55  
    56  function NextButtonClick(CurPageID: Integer): Boolean;
    57  begin
    58    if CurPageID = OptionPage.ID then
    59    begin
    60      if OptionPage.Values[1] then
    61      begin
    62        // override the default installation to program files ({pf})
    63        WizardForm.DirEdit.Text := ExpandConstant('{userappdata}\Cloud Foundry')
    64      end
    65        else
    66      begin
    67        WizardForm.DirEdit.Text := ExpandConstant('{pf}\Cloud Foundry');
    68      end;
    69    end;
    70    Result := True;
    71  end;