Boost logo

Boost Users :

From: Olivier Delande (olivier.delande.spam_at_[hidden])
Date: 2007-12-12 15:43:31


I noticed something which looks pretty much like a bug in the filesystem
library. Both version 1.34.1 and CVS are affected under Linux. I do not
know about other versions/platforms.

If I compile and run the following code

-----------------------------------
#include <boost/filesystem.hpp>
#include <iostream>

int main(int argc, char *argv[])
{
        boost::filesystem::wpath p(L"/");
        boost::filesystem::wdirectory_iterator i(p);
        return 0;
}
-----------------------------------

then I get an exception:

-----------------------------------
terminate called after throwing an instance of
'boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
boost::filesystem::wpath_traits> >'
  what(): boost::filesystem::wpath::to_external conversion error: Invalid
argument
Aborted
-----------------------------------

However, the following alternate version (which uses char instead of
wchar_t) works:

-----------------------------------
#include <boost/filesystem.hpp>
#include <iostream>

int main(int argc, char *argv[])
{
        boost::filesystem::path p("/");
        boost::filesystem::directory_iterator i(p);
        return 0;
}
-----------------------------------

Has anyone ever found a way to cope with that or filed a bug?

Thanks -- Olivier


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