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.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to