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