Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-12-18 01:21:54

Beman Dawes wrote:

> > > Care to contribute it?
> >
> >See attachment.
> Nice!
> > 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.
> Yes, I think so too.
> How about the following? Note that moving the "exists" up also prevents
> the problem of trying to create_directories on the root directory.
> void create_directories(const path& ph)
> {
> if (ph.empty() || exists(ph))
> return;
> // First create branch, by calling ourself recursively
> create_directories(ph.branch_path());
> // Now that parent's path exists, create the directory
> create_directory(ph);
> }

I agree to this.

> >OTOH, this behaviour is different from 'create_directory', which
> throws if
> >directory does not exist.
> No different from remove/remove_all. The convenience functions should be
> just that; convenient. Worrying about consistency produces a less useful
> interface.

OK, complete agreement.

> >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?

- Volodya

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