* fix and cleanup FileSearch

git-svn-id: trunk@10115 -
This commit is contained in:
peter 2008-01-30 11:57:23 +00:00
parent 82694127a2
commit e08570573f

View File

@ -25,11 +25,9 @@
begin
Result:='';
temp:=Dirlist;
temp:=SetDirSeparators(DirList);
repeat
While (Length(Temp)>0) and (Temp[1]=PathSeparator) do
Delete(Temp,1,1);
I:=pos(PathSep,Temp);
I:=pos(PathSeparator,Temp);
If I<>0 then
begin
Result:=Copy (Temp,1,i-1);
@ -40,12 +38,14 @@
Result:=Temp;
Temp:='';
end;
If (Length(Result)>0) and (result[length(result)] in AllowDirectorySeparators) then
Result:=Result+DirectorySeparator;
Result:=Result+name;
If not FileExists(Result) Then
Result:='';
until (length(temp)=0) or (length(result)<>0);
if Result<>'' then
begin
Result:=IncludeTrailingPathDelimiter(Result)+name;
If FileExists(Result) Then
exit;
end;
until temp='';
result:='';
end;
{$ifndef OS_FILEISREADONLY}