[fpc-pascal] FPC docs about FindFirst

Anthony Walter sysrpl at gmail.com
Tue Sep 24 07:57:43 CEST 2019


Related,

It would seem on Linux that FindFirst, FindNext or TSearchRec that none of
them can properly detect a symbolic link. For example, if you wanted
enumerate files and folder, and there exists a symbolic link inside one
folder to some parent of said folder, it's not possible to detect leading
to endless recursion. faSymLink currently isn't picked up. I have to use
code like this:

uses
  BaseUnix;

function IsSymLink(const Path: string): Boolean;
var
  Stat: TStat;
begin
  fpLstat(PChar(Path), Stat);
  Result := fpS_ISLNK(Stat.st_mode);
end;

Which slows down the search a bit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190924/8dca6b0e/attachment.html>


More information about the fpc-pascal mailing list