Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2004-03-09 12:50:40


On Tue, 09 Mar 2004 11:36:52 -0500, Beman Dawes wrote
> That's an interesting thought. Of course, it might not be another
> thread but rather another process that created the directory, and
> that could be a sign of real trouble.
>
> But such a change would allow simpler user code. What is now written:
>
> if ( !exists( foo ) ) create_directory( foo );
>
> becomes:
>
> create_directory( foo );
>
>
> What happens when the directory existing really does constitute and
> error, and create_directory() doesn't throw? Will applications fail
> in difficult to diagnose ways? Can applications protect themselves
> against silent failure?
  
How about something like:
 void create_directory ( const path& name, bool error_if_exists = false);

Then the application can decide -- defaulting to nothrow.

> What happens if the path exists but is not a directory? Presumably
> that case must still throw.

Yes, I think so.

Jeff


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