|
Boost Users : |
Subject: Re: [Boost-users] using boost::filesystem::delete
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-03-03 14:05:13
On Tue, Mar 3, 2009 at 12:43, Everton Patitucci <patucci_at_[hidden]> wrote:
>
>> I have a boost::filesystem::wpath object. I need to firstly check if the
>> file exists, and secondly delete and check the file has been deleted.
>> How would I go about this?
>> I've loked at the reference and carn't seem to make sense, are thee any
>> examples of both these functions?
>>
>> Sean.
>
> removing a file...
> http://www.boost.org/doc/libs/1_38_0/libs/filesystem/doc/reference.html#Operations-functions
> sixth method.
>
Remove doesn't consider file not found to be an error, so why check?
Checking -- either before or after -- introduces race conditions. If
remove doesn't throw, then the file was gone at that point.
Confirming that seems like a waste of effort.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net