Boost logo

Boost :

From: John Maddock (john_maddock_at_[hidden])
Date: 2002-09-20 06:33:13


The following comments are mostly based on a review of the filesys lib docs.

Let me say up front that I like the library and think that it should be
accepted into boost.


I don't really like the operator << usage, personally I would have

path::append(const path&);
path::operator+=(const path&);
path operator+(const path&, const path&);

It's a pity that there are two different functions: file_path and
directory_path, these look error prone in usage to me: on most platforms
they will always return the same thing so potential bugs will never be
caught. I can't really see any fix though :-(

All the functions generic_path, file_path, directory_path, leaf, and branch,
are under-documented IMO. I had to read the specs quite closely before I
could figure out which did what. Adding examples to each would probably be
a help, or maybe a "description" section that provides a less terse
description than the standardese.

I agree with comments made elsewhere that we need an "is_absolute" function,
in spite of the difficulties.


Question: how does remove interact with directories? Will it remove
non-empty directories, it should say so one way or the other. OK reading it
again I see:

Throws: exists(ph) && is_directory(ph) && !is_empty(ph)

which I assume means it should throw for non-empty directories? Shouldn't
the throw clause say what it throws, followed by when. Otherwise it reads
like the function always throws a bool ! :-)

Question: what's the difference between remove and remove_all?

Comment: I think that the semantics of initial_directory are almost useless,
I what to know what the current working directory is *right now*, not what
it was at some unspecified time in the past. I would also like to be able
to set the present working directory when required (I realise that there are
OS's where this may not be possible, but no-one said the function always had
to succeed).

Missing functions

These are offered by way of a wish list, I don't see any need for these
functions to be added right now:

Access to the CMA times of a file.
Access to the size of a file.
Access to the attributes of a file (probably only read/write/execute
Ability to set the attributes of a file (probably only read/write/execute
permissions, and only for the current user).

Missing examples

These are by way of a wish list, I think that their addition would help
verify that the library does in fact cover all the necessary bases, but I
don't see any need to insist on them right now:

Implementations of the unix utilities: mv, cp, ls.


I'll look at this later.


Nice work Beman!

John Maddock

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