Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-12-17 04:42:20


Beman Dawes wrote:

> >6. Would it be reasonable to introduce a function "create_directories",
> > similiar in spirit to "remove_all"? That function would create
> > intermediate directories, not only the leaf one.
>
> Yes, that would be both reasonable and useful. The
> filesystem/convenience.hpp header we've discussed would be a good place.

Agreed. BTW, where would that header live? In CVS tree or in sandbox? And
what would be the access rules?

>
> Care to contribute it?

See attachment. A pretty trivial excersice, of course, except for one
point. The create_directories function as written by me does nothing (not
throws) if you call it on existing directory. And explicit "exists" all is
certainly needed for parent directories, and I'm not sure what to do with
the full directory.

Allowing it to exist seems in spirit of this function --- after all it
automatically creates needed directories and does nothing with already existing.

OTOH, this behaviour is different from 'create_directory', which throws if
directory does not exist.

Lastly, we probably can't change create_directory, at least for one reason.
On Linux, this operation is atomic, and can be used to make locks. I guess,
the same is true on Windows. If 'create_directory' checks for existence, you
cannot use it for locking any more.

So, what's the right interface?

- Volodya






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