mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-03 02:23:40 +02:00
LazUtils: reimplement the test for faDirectory in TFileSearcher.Search. FindFirst returns files in any case.
git-svn-id: trunk@39312 -
This commit is contained in:
parent
25275d022b
commit
b51b639fab
@ -1469,7 +1469,7 @@ var
|
|||||||
// skip special files
|
// skip special files
|
||||||
if (PathInfo.Name = '.') or (PathInfo.Name = '..') or
|
if (PathInfo.Name = '.') or (PathInfo.Name = '..') or
|
||||||
(PathInfo.Name = '') then Continue;
|
(PathInfo.Name = '') then Continue;
|
||||||
|
// Deal with both files and directories
|
||||||
if (PathInfo.Attr and faDirectory) = 0 then
|
if (PathInfo.Attr and faDirectory) = 0 then
|
||||||
begin
|
begin
|
||||||
if (MaskList = nil) or MaskList.Matches(PathInfo.Name) then
|
if (MaskList = nil) or MaskList.Matches(PathInfo.Name) then
|
||||||
@ -1492,13 +1492,14 @@ var
|
|||||||
finally
|
finally
|
||||||
FindCloseUTF8(PathInfo);
|
FindCloseUTF8(PathInfo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ASearchSubDirs or (ALevel > 0) then // search recursively in directories
|
if ASearchSubDirs or (ALevel > 0) then
|
||||||
|
// search recursively in directories
|
||||||
if FindFirstUTF8(P, faDirectory, PathInfo) = 0 then
|
if FindFirstUTF8(P, faDirectory, PathInfo) = 0 then
|
||||||
try
|
try
|
||||||
repeat
|
repeat
|
||||||
if (PathInfo.Name = '.') or (PathInfo.Name = '..') or
|
if (PathInfo.Name = '.') or (PathInfo.Name = '..') or
|
||||||
(PathInfo.Name = '')
|
(PathInfo.Name = '') or ((PathInfo.Attr and faDirectory) = 0)
|
||||||
then Continue;
|
then Continue;
|
||||||
|
|
||||||
FPath := APath;
|
FPath := APath;
|
||||||
|
Loading…
Reference in New Issue
Block a user