Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-12-23 03:06:34


Beman Dawes wrote:
> Volodya,
>
> >>>Agreed. BTW, where would that header live? In CVS tree or in sandbox?
> >>>And what would be the access rules?
>
> >No comment on this? Or, specifically, do you plan to add
> convenience.hpp to
> >some CVS tree and place create_directories there any time soon?
>
> I've just added these convenience files to the main CVS:
>
> boost/filesystem/convenience.hpp
> libs/filesystem/doc/convenience.htm
> libs/filesystem/src/convenience.cpp
> libs/filesystem/test/convenience_test.cpp
>
> plus updated doc/index.htm, and the build and test Jamfiles to reference
> convenience.
>
> Take a look and see if I've missed anything.

Everything looks OK.

> doc/convenience.htm is just a shell; I'm hoping you'll add
> create_directories() docs.

Added.

>
> There needs to be some kind of precondition. Maybe:
>
> !exists(ph) || is_directory(ph)
>
> but it is more complicated than that. Say you code:
>
> create_directories( "xx/yy/zz" );
>
> If zz doesn't exist, and xx/yy does, then xx/yy has to be a directory;
> xx/yy can't be a file. I'm not sure how to express a recursive
> precondition.

I've writted that using "forall", as mathematicians do. Hope this makes
sense. Please take a look at the docs. I've had to use "is_parent"
function, which does not exists, but hopefully the meaning is clear.

> What are the postconditions? In your posting, you gave:
>
> exists(ph) && is_directory(ph) && is_empty(ph)
>
> But is_empty(ph) would only apply if a new directory was created.

You are right.

> There are also the cases create_directory("") and

Explicitly permitted by new preconditions.

> create_directory("/").

To begin with, what's this? More concrete question --- is this
empty relative path with trailing "/" or empty root name,
followed by root directory, and then empty relative path?

If this is the latter case, then... "/" is a directory and it
most surely exists. See no problem there --- preconditions are
satisfied.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk