Boost logo

Boost Users :

Subject: [Boost-users] [filesystem] misidentifies file type on Solaris x86 64-bit
From: Will Mason (willchido_at_[hidden])
Date: 2011-08-11 18:50:11


Hello,
I'm using Boost 1.46.1 with filesystem v3. Code that I've been running
successfully on Windows, Linux and FreeBSD started producing very mysterious
results on Solaris. I boiled it down to this: boost::filesystem will not
identify a directory as a directory. Here's a test program:

#include <boost/filesystem.hpp>

int main()
{
    try
    {
        boost::filesystem::path d(boost::filesystem::absolute("dir"));
        if (boost::filesystem::exists(d))
        {
            std::cout << d << " already exists" << std::endl;
        }
        else
        {
            boost::filesystem::create_directory(d);
            std::cout << d << " is " << (boost::filesystem::is_directory(d)
? "" : "not") <<
                " a directory" << std::endl;
        }
    }
    catch (std::exception& e)
    {
        std::cout << "Exception: " << e.what() << std::endl;
    }
    return 0;
}

And here is a snippet of a terminal session compiling and running the
program:

$ CC -o fstest fstest.cpp -library=stlport4
-Iexternal/solaris/x86/64/suncc/5.11/include
external/solaris/x86/64/suncc/5.11/lib/libboost_filesystem.a
external/solaris/x86/64/suncc/5.11/lib/libboost_system.a
$ ./fstest
"/export/home/will/Projects/cap/dir" is not a directory
$ file /export/home/will/Projects/cap/dir
/export/home/will/Projects/cap/dir: directory
$

Thanks for any help,
Will



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