Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

FindFirst / FindNext with faHidden under Linux

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I'm doing a FindFirst / FindNext and fitering out all faHidden and faDirectory results.
I don't want to show and dot (.<name>) directories as they are considered hidden under Linux.
Yet FindFirst / FindNext doesn't have the faHidden flag set for those directories

Is there another function or another way I can filter out any dot directories (.<name>) from the results?

Regards,
- Graeme -

Graeme Geldenhuys
to Graeme Geldenhuys

Currently I am doing the following test to filter out the following directories I consider hidden.

Hidden directories are: .<name> or '.' or '..'

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

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.

Couldn't FindFirst() and FindNext() do the same test under unix type OS's and then set the faHidden appropriately?

Regards,
- Graeme -

Graeme Geldenhuys wrote 15 lines
Hi, I'm doing a FindFirst / FindNext and fitering out all faHidden and faDirectory results. I don't want to show and dot (.<name>) directories as they are considered hidden under Linux. Yet FindFirst / FindNext doesn't have the faHidden flag set for those directories Is there another function or another way I can filter out any dot directories (.<name>) from the results? Regards, - Graeme -
Daniël Mantione
to Graeme Geldenhuys: I'm doing a FindFirst / FindNext and fitering out all faHidden and faDirectory results. I…

Op Tue, 12 Jun 2007, schreef Graeme Geldenhuys:

Show quoted text 11 lines
Hi, I'm doing a FindFirst / FindNext and fitering out all faHidden and faDirectory results. I don't want to show and dot (.<name>) directories as they are considered hidden under Linux. Yet FindFirst / FindNext doesn't have the faHidden flag set for those directories Is there another function or another way I can filter out any dot directories (.<name>) from the results?

Check if they start with a dot :)

There simply exists no hidden atrribute; the hiding is done by the shell and possibly the applications; at API level there exist no hiding in Unix.

Daniël

Marco van de Voort
to Graeme Geldenhuys: Currently I am doing the following test to filter out the following directories I…
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)

Show quoted text 5 lines
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.