procedure TUnitNameList.LoadFromSysPath;
var
I: Integer;
Paths: TStringList;
begin
Paths := TStringList.Create;
try
Paths.Sorted := True;
GetLibraryPath(Paths, False);
if not SameText(Paths.Text, FSysPath) then
begin
FSysUnits.Clear;
FCurrList := FSysUnits;
for I := 0 to Paths.Count - 1 do
begin
FindFile(Paths[I], '*.pas', DoFindFile, nil, False, False);
FindFile(Paths[I], '*.dcu', DoFindFile, nil, False, False);
end;
FindFile(MakePath(GetInstallDir) + 'Lib\', '*.dcu', DoFindFile, nil,
False, False);
UpdateCaseFromModules(FSysUnits);
FSysPath := Paths.Text;
end;
finally
Paths.Free;
end;
for I := 0 to FSysUnits.Count - 1 do
AddUnit(FSysUnits[I]);
end;
// 取环境设置中的 LibraryPath 内容
procedure GetLibraryPath(Paths: TStrings; IncludeProjectPath: Boolean);
var
Svcs: IOTAServices;
Options: IOTAEnvironmentOptions;
Text: string;
List: TStrings;
procedure AddList(AList: TStrings);
var
S: string;
i: Integer;
begin
for i := 0 to List.Count - 1 do
begin
S := Trim(MakePath(List));
if (S <> '') and (Paths.IndexOf(S) < 0) then
Paths.Add(S);
end;
end;
begin
Svcs := BorlandIDEServices as IOTAServices;
if not Assigned(Svcs) then Exit;
Options := Svcs.GetEnvironmentOptions;
if not Assigned(Options) then Exit;
List := TStringList.Create;
try
Text := ReplaceToActualPath(Options.GetOptionValue('LibraryPath'));
List.Text := StringReplace(Text, ';', #13#10, [rfReplaceAll]);
AddList(List);
Text := ReplaceToActualPath(Options.GetOptionValue('BrowsingPath'));
List.Text := StringReplace(Text, ';', #13#10, [rfReplaceAll]);
AddList(List);
if IncludeProjectPath then
begin
GetProjectLibPath(List);
AddList(List);
end;
finally
List.Free;
end;
end;
// Text := ReplaceToActualPath(Options.GetOptionValue('LibraryPath'));
Text := ReplaceToActualPath(RegReadStringDef(HKEY_CURRENT_USER,
'Software\Embarcadero\BDS\17.0\Library\Win32','Search Path',''));
// Text := ReplaceToActualPath(Options.GetOptionValue('BrowsingPath'));
Text := ReplaceToActualPath(RegReadStringDef(HKEY_CURRENT_USER,
'Software\Embarcadero\BDS\17.0\Library\Win32','Browsing Path',''));