diff --git a/jcl/source/common/JclIDEUtils.pas b/jcl/source/common/JclIDEUtils.pas index c78830077..083cb59a3 100644 --- a/jcl/source/common/JclIDEUtils.pas +++ b/jcl/source/common/JclIDEUtils.pas @@ -792,6 +792,7 @@ TJclBorRADToolInstallations = class(TObject) function GetBCBInstallationFromVersion(VersionNumber: Integer): TJclBorRADToolInstallation; function GetDelphiInstallationFromVersion(VersionNumber: Integer): TJclBorRADToolInstallation; protected + procedure AddInstallation(CreateClass: TJclBorRADToolInstallationClass; const VersionKeyName: string); procedure ReadInstallations; public constructor Create; @@ -5328,20 +5329,29 @@ function TJclBorRADToolInstallations.Iterate(TraverseMethod: TTraverseMethod): B Result := Result and TraverseMethod(Installations[I]); end; +procedure TJclBorRADToolInstallations.AddInstallation(CreateClass: TJclBorRADToolInstallationClass; const VersionKeyName: string); +var + Installation: TJclBorRADToolInstallation; +begin + Installation := CreateClass.Create(VersionKeyName); + if Installation.Valid then + FList.Add(Installation) + else + Installation.Free; +end; + procedure TJclBorRADToolInstallations.ReadInstallations; var VersionNumbers: TStringList; PreviousRegWOW64AccessMode: TJclRegWOW64Access; - function EnumVersions(const KeyName: string; const Personalities: array of string; - CreateClass: TJclBorRADToolInstallationClass): Boolean; + procedure EnumVersions(const KeyName: string; const Personalities: array of string; + CreateClass: TJclBorRADToolInstallationClass); var I, J: Integer; VersionKeyName, PersonalitiesKeyName: string; PersonalitiesList: TStrings; - Installation: TJclBorRADToolInstallation; begin - Result := False; if RegKeyExists(HKEY_LOCAL_MACHINE, KeyName) and RegGetKeyNames(HKEY_LOCAL_MACHINE, KeyName, VersionNumbers) then for I := 0 to VersionNumbers.Count - 1 do @@ -5352,13 +5362,7 @@ procedure TJclBorRADToolInstallations.ReadInstallations; begin if Length(Personalities) = 0 then begin - try - Installation := CreateClass.Create(VersionKeyName); - if Installation.Valid then - FList.Add(Installation); - finally - Result := True; - end; + AddInstallation(CreateClass, VersionKeyName); end else begin @@ -5371,15 +5375,7 @@ procedure TJclBorRADToolInstallations.ReadInstallations; for J := Low(Personalities) to High(Personalities) do if PersonalitiesList.IndexOf(Personalities[J]) >= 0 then begin - try - Installation := CreateClass.Create(VersionKeyName); - if Installation.Valid then - FList.Add(Installation) - else - Installation.Free; - finally - Result := True; - end; + AddInstallation(CreateClass, VersionKeyName); Break; end; finally