Boost logo

Boost Users :

Subject: [Boost-users] [filesystem] exists() throws if no disk in CD-ROM drive (Boost version 1.41)
From: PB (newbarker_at_[hidden])
Date: 2010-03-30 05:59:31


Hello,

I was looking to remove a wrapper function I wrote a while ago when I
was using Boost 1.35.0. This wrapper caught exceptions from
boost::filesystem::exists and returned false:

bool PathExists(const boost::filesystem::path& path)
{
        try
        {
                return boost::filesystem::exists(path);
        }
        catch(const boost::filesystem::filesystem_error&)
        {
                return false;
        }
}

Now our organisation has upgraded to 1.41.0 I wanted to get rid of the
wrapper as I can see that ticket 2725
(https://svn.boost.org/trac/boost/ticket/2725) has been fixed in
1.37.0.

A quick test shows that I'm still getting exceptions from
boost::filesystem::exists() when referring to a CD-ROM drive without
any media in it:

#include <iostream>

#include <boost/filesystem/operations.hpp>

int main()
{
        std::cout << boost::filesystem::exists("d:\\afile.txt") << std::endl;
}

Could someone take a look at this please?

Many thanks,

Pete


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