|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-05-08 10:53:45
In http://www.esva.net/~beman/filesystem_operations_predicates.htm, the
assumptions was that file system entities are either files or directories.
But an operating system might support additional file system entities which
can only be accessed via a specific API, and can't be accessed via fstreams
or directory_iterators.
For example, on some operating systems, sockets are file system entities
and may be found during directory iterations, but can't be opened as either
directories or fstreams.
What to do? Possibilities:
1) Add an other_flag and a matching is_other() function. Change definition
of exists() to status() & (directory_flag|file_flag|other_flag)
2) Try to identify specific other types like sockets, and define flags and
predicate functions for each. Handle future needs by saying an
implementation has to define suitable flags and predicate functions for any
additional kinds of files.
3) Treat such entities as files.
4) Treat such entities as errors.
5) Treat such entities as not found.
To me, (1) seems best. (2) is too open ended, and without a matching API to
access the additional types, doesn't do much beyond (1). The others are not
acceptable because they are misleading and don't match expectations.
Comments?
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk