[fpc-pascal]directory tree in memory

Marco van de Voort marcov at stack.nl
Mon Oct 15 10:04:36 CEST 2001


> > end;
> >
> > myDirs :tList;
> >
> > What I do is store the file/directory name and the like in DirsItem.info and if it's a directory "sub" points to another tList with the contents of that directory.
> > It works but I would like to know if someone have a better solution for this problem. I'm not very happy with the performance when I have to find a file in it.
> 
> Use a TStringList object instead of a Tlist.
> Store the name in the string, and in the Object, store
> 
> TMyFileObject
>   Into : TFileInfo;
>   Sub : TStringList;
> end;
> 
> If the stringlist object is sorted (Sorted:=True) then any search will use a binary search,
> thus speeding up the search quite a lot.

I still have some directory traversal routines. Afaik they are even in
xtdfpc on my page (see contrib page). Unit is called odirtree or so.




More information about the fpc-pascal mailing list