Forum > General

findallfiles hangs

(1/2) > >>

hakelm:
I am trying to list my files on Ubuntu,  Lazarus 1.9 with
  files:=tstringlist.Create;
  findallfiles(files,'/');
but findallfiles never returns.
I suspect that findallfiles follows links and plays ping-pong with itself.
Is that so or is there any other reason?
How can I get findallfiles to work?
Thanks in advance for any tip.
H

Bart:
You can try to set the propert FollowSymlinks to False?

Bart

hakelm:
Thanks,
but I can't see that

procedure FindAllFiles(AList: TStrings; const SearchPath: String;
  SearchMask: String = ''; SearchSubDirs: Boolean = True; DirAttr: Word = faDirectory);
or
function FindAllFiles(const SearchPath: String; SearchMask: String = '';
  SearchSubDirs: Boolean = True): TStringList;

has any parameter FollowSymlinks.
The DirAttr are only faReadOnly, faHidden,faSysFile, faVolumeId,faDirectory,faArchive.
H

howardpc:
Yes, you need a slightly extended FindAllFiles routine, such as this


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses FileUtil; procedure FindAllFiles(AList: TStrings; const SearchPath: String;  SearchMask: String; SearchSubDirs, FollowSymLinks: Boolean; DirAttr: Word); overload;var  Searcher: TListFileSearcher;begin  Searcher := TListFileSearcher.Create(AList);  Searcher.DirectoryAttribute := DirAttr;  Searcher.FollowSymLink := FollowSymLinks;  try    Searcher.Search(SearchPath, SearchMask, SearchSubDirs);  finally    Searcher.Free;  end;end;

hakelm:
Thanks,
seems to do the trick.
H

Navigation

[0] Message Index

[#] Next page

Go to full version