[fpc-devel] question about TSearchRec

Michael Van Canneyt michael at freepascal.org
Sun Jun 12 13:01:50 CEST 2011



On Sun, 12 Jun 2011, zeljko wrote:

> Hi all,
> Just tried something with file searching and cannot remember if it's different
> from dcc. fpc-2.4.3 on linux.
>
> sr: TSearchRec;
> if FindFirst('/blah/*,fileAttr, sr)
>  repeat
>    // here
>   sr.PathOnly is empty .... ok

Don't use PathOnly, it is deprecated and scheduled for removal.

>   but in case of filename
>   sr.FileName is extracted so there's no file path inside filename or even
> written to sr.PathOnly.

FileName does not exist. Only Name exists, and it contains just the filename part.

>
>  until FindNext() = 0;
> end;
>
> So, is it different from dcc ? afaik I didn't make acrobations with this under
> kylix (remember each level of dir) because filename already contained path.
> Anyone ?

You must always remember the directory.
I do this since day 1.

Michael.



More information about the fpc-devel mailing list