Sign in Join

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

Mailing lists / fpc-devel / 2007-08

FindFirst with faAnyFile doesn't return all files.

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Hi,

This was posted in the Lazarus mailing list a while back. Has this been report or fixed in FPC?

--------------- Copy ------------------------
I have had some headaches while using FindFirst function to search for files in a folder.
I would share some gained knowledge with the people on this list.

Everybody knows about file attributes (archive, system, hidden, read only). If someone use FindFirst('*.*', faAnyFile, SearchRec) it assumes that faAnyFile is enough to get every file from the directory. No, it is not. If a file has none of the attributes set, the faAnyFile will not include that file in the search.
Those files, without any of the mentioned attributes set, they have attribute Normal, and this attribute is not defined as faNormal anywhere in RTL ( see
http://www.freepascal.org/docs-html/rtl/dos/fileattributes.html ). If one would like to get all the files from a folder by using FindFirst and FindNext, then he should use:
FindFirst('*.*', faAnyFile or $00000080, SearchRec);

--------------- END ------------------------

Apparently the same thing occurs in Delphi, but I also believe this is a bug and should be solve (if not yet done) in FPC.

Regards,
- Graeme -

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Hi, This was posted in the Lazarus mailing list a while back. Has this been report or fixed in FPC?

Neither reported nor fixed.

Please create a bug report in the FPC bugtracker.

Michael.

Show quoted text 31 lines
--------------- Copy ------------------------ I have had some headaches while using FindFirst function to search for files in a folder. I would share some gained knowledge with the people on this list. Everybody knows about file attributes (archive, system, hidden, read only). If someone use FindFirst('*.*', faAnyFile, SearchRec) it assumes that faAnyFile is enough to get every file from the directory. No, it is not. If a file has none of the attributes set, the faAnyFile will not include that file in the search. Those files, without any of the mentioned attributes set, they have attribute Normal, and this attribute is not defined as faNormal anywhere in RTL ( see http://www.freepascal.org/docs-html/rtl/dos/fileattributes.html ). If one would like to get all the files from a folder by using FindFirst and FindNext, then he should use: FindFirst('*.*', faAnyFile or $00000080, SearchRec); --------------- END ------------------------ Apparently the same thing occurs in Delphi, but I also believe this is a bug and should be solve (if not yet done) in FPC. Regards, - Graeme - _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt

Thanks. Reported as bug 9440.

Graeme.

Michael Van Canneyt wrote 14 lines
On Wed, 15 Aug 2007, Graeme Geldenhuys wrote: > Hi, > > This was posted in the Lazarus mailing list a while back. Has this > been report or fixed in FPC? Neither reported nor fixed. Please create a bug report in the FPC bugtracker. Michael.

Reply by email