[fpc-pascal] Re: FindFirst / FindNext with faHidden under Linux

Marco van de Voort marcov at stack.nl
Tue Jun 12 17:21:53 CEST 2007

> Currently I am doing the following test to filter out the following
> directories I consider hidden.
> Hidden directories are:  .<name>  or '.'  or '..'

(in the following code you access s[1] without checking length first)

>   repeat
>       if (s[1] in ['.']) or (s = '..') then
>         continue;
>      [...process non-hidden directories here...]
>   until FindNext(...);

Note that hiding "." under Unix is only an application convention, and only
for vision. Emulating system behaviour like under windows in general purpose
routines is not a good idea.

> Is there a better way of doing this?  This code need to run on
> multiple platforms. I guess considering a .<name> directory hidden
> under Windows is not ideas, but I can live with it.

Make a decent wrapper routine that does Fahidden on the platforms that
support it, and that masks "." on platforms that you think should.
> Couldn't FindFirst() and FindNext() do the same test under unix type
> OS's and then set the faHidden appropriately?

I don't think is wise. This is presentation behaviour, and should be solved
in corresponding (G)UI components, not on the system level.

More information about the fpc-pascal mailing list