Boost logo

Boost :

From: Ross Smith (r-smith_at_[hidden])
Date: 2002-03-26 16:12:50

Beman Dawes wrote:
> Attached is an updated version of boost\filesystem\directory.hpp.
> It uses the options approach discussed previously.
> It seems to me to be a lot cleaner and more usable than the previous
> attempt, which relied on explicitly named functions.
> Comments?

It's an improvement, especially replacing the numerous variant functions
with options, but there are still a few problems.

-- You're still blithely ignoring the massive difficulty (impossibility
without great gobs of nonportable code) of implementing is_readonly() on
unixoid OSes.

"!fopen(path,"a+")" is neither a useful specification (what if there's
no more room on the disk?) nor a useful implementation (it would change
the file's modification date if it's writable).

-- What does is_empty() do? The name doesn't suggest anything to me. (If
it's size==0, why isn't there a size() function?)

-- create_directory() needs an option to create any necessary parent
directories (mkdir -p). At least, I don't think it does that now; it's
hard to tell from your description (branch? leaf?).

-- There's a move() but no copy(). Oversight?

-- In the interests of generality, if you're only going to provide one
conditional-delete function, it really needs to be the predicate one,
not the regex one. The latter is trivial given the former, but if you
only have the latter, anything else has to be hand-coded. On the other
hand, I'm dubious about the need for selective-delete operations in
general: hand-coding them is easy; I don't see any reason why
selective-delete would be more useful than any of the other
selective-whatever functions that aren't there; and I can think of any
number of operations that I'd put in a file handing library before

-- Top of that list would be is_ordinary_file() vs is_special_file().

Others I'd like to see (from a quick vgrep through my own code):

-- Functions to split a path into its component parts. (Is this what
branch + leaf do?)

-- Function to resolve a relative path into a fully qualified absolute

-- Other properties of a file. size() and last_modified() are the
obvious ones.

Ross Smith ...................................... Auckland, New Zealand
r-smith_at_[hidden] ....................................................
  "We need a new cosmology. New gods. New sacraments. Another drink."
                                                       -- Patti Smith

Boost list run by bdawes at, gregod at, cpdaniel at, john at