Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost.filesystem] remove issue
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-05-17 18:47:33

On Mon, May 18, 2009 at 12:03 AM, Sean Farrow

> Hi:
> I don't think i am, I was under the impression that argv[0] gave me the
> full executable path. If not, how do I obtain this.
> Cheers
> Sean.

Oh, sorry, my fault. But in that case you are trying to do smth very strange

Take a look at the signature of path::filename. It returns a copy of the
filename part. You just assign a new value to the temporary string. And than
your app tries to delete the executable itself, which is locked by the
running process. That's why you get an error.

Your intention probably was:
path.remove_filename() /= L"compilation date.txt";
if (boost::filesystem::exists(path))
    boost::filesystem::remove(path); //should work


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at