Boost logo

Boost Users :

Subject: [Boost-users] [Filesystem] Problem with uncatchable exception when checking empty card reader
From: Marco Wedekind (Marco.Wedekind_at_[hidden])
Date: 2009-09-14 11:52:27


Hello,

I am using the Filesystem library from boost 1.38.0 on Windows (Visual Studio 2005) like this:

if (boost::filesystem::exists("W:") && boost::filesystem::is_empty("W:"))
{
  ... do something useful ...
}

"W:" is assigned to an (usually) empty card reader slot. Unfortunately Filesystem's exists() function fails with an uncatchable exception. At least I cannot catch it... The exception is thrown by GetFileAttributesA() in operations.hpp:

  inline DWORD get_file_attributes( const char * ph )
    { return ::GetFileAttributesA( ph ); }

The exception pops up an error message that is titled "Windows - no disc" and it says:

Exception Processing Message c0000013 Parameters 75b0bf9c 4 75b0bf9c 75b0bf9c

Sadly, all I can do is to prefix a call to exists() with a call to GetVolumeInformationA() (from winbase.h) like this:

if (GetVolumeInformationA("W:", NULL, NULL, NULL, NULL, NULL, NULL, NULL))
{
  if (boost::filesystem::exists("W:") && boost::filesystem::is_empty("W:"))
  {
    ... do something useful ...
  }
}

Is there any way to do this platform-independent?

I have been searching the docs and the boost website, google and so on, to see if that can already be done with boost Filesystem. Since I did not find anything on this topic, I hope you can put me on the right track.

Cheers,

Marco
 
Marco Wedekind | Software Developer | marco.wedekind_at_[hidden] | +49(0)34124495-62 office | +49(0)34124495-25 fax
TomTom Development Germany GmbH, Maximilianallee 4, D-04129 Leipzig, Germany | www.tomtomwork.com
Amtsgericht Leipzig | HRB 22234 | Geschäftsführer: Thomas Schmidt, Marina Wyatt
 Think before you print

This e-mail message contains information which is confidential and may be privileged. It is intended for use by the addressee only. If you are not the intended addressee, we request that you notify the sender immediately and delete or destroy this e-mail message and any attachment(s), without copying, saving, forwarding, disclosing or using its contents in any other way. TomTom N.V., TomTom Software, Ltd or any other company belonging to the TomTom group of companies will not be liable for damage relating to the communication by e-mail of data, documents or any other information.

This e-mail message contains information which is confidential and may be privileged. It is intended for use by the addressee only. If you are not the intended addressee, we request that you notify the sender immediately and delete or destroy this e-mail message and any attachment(s), without copying, saving, forwarding, disclosing or using its contents in any other way. TomTom N.V., TomTom Software, Ltd or any other company belonging to the TomTom group of companies will not be liable for damage relating to the communication by e-mail of data, documents or any other information.


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