IDE, initial setup dlg: Use depth first strategy for searching

git-svn-id: trunk@39304 -
This commit is contained in:
juha 2012-11-19 01:14:09 +00:00
parent d38f2da57d
commit 49943df153

View File

@ -1215,19 +1215,20 @@ end;
procedure TSearchFpcSourceThread.DoSearch(const APath: String); procedure TSearchFpcSourceThread.DoSearch(const APath: String);
var var
PathInfo: TSearchRec; PathInfo: TSearchRec;
FPCSrc: TSDFileInfo;
begin begin
if FindFirstUTF8(APath+AllDirectoryEntriesMask, faDirectory, PathInfo) = 0 then if FindFirstUTF8(APath+AllDirectoryEntriesMask, faDirectory, PathInfo) = 0 then
try try
repeat repeat
if (PathInfo.Name='') or (PathInfo.Name[1]='.') then Continue;
if Terminated then Break; if Terminated then Break;
// fPath := APath; fFileInfo := PathInfo; Synchronize(@Debug); if (PathInfo.Name='') or (PathInfo.Name[1]='.') then Continue;
Assert(PathInfo.Name = ChompPathDelim(PathInfo.Name)); //fPath := APath; fFileInfo := PathInfo; Synchronize(@Debug);
fFoundFPCSrc:=CheckFPCSrcDir(APath+PathInfo.Name); DoSearch(AppendPathDelim(APath+PathInfo.Name)); // Recursive call
if Assigned(fFoundFPCSrc) then FPCSrc:=CheckFPCSrcDir(APath+PathInfo.Name);
Terminate // An exact match was found. if Assigned(FPCSrc) then begin
else fFoundFPCSrc:=FPCSrc; // An exact match was found.
DoSearch(AppendPathDelim(APath+PathInfo.Name)); // Recursive call Terminate;
end;
until (FindNextUTF8(PathInfo) <> 0); until (FindNextUTF8(PathInfo) <> 0);
finally finally
FindCloseUTF8(PathInfo); FindCloseUTF8(PathInfo);