mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 11:49:23 +02:00
* fix and cleanup FileSearch
git-svn-id: trunk@10115 -
This commit is contained in:
parent
82694127a2
commit
e08570573f
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user