I’m iterating through a directory on windows (c:\) and it is throwing an exception saying the file isn’t found when I call is_directory on it.

 

Here is my code

 

        filesystem::path boostdir("c:\\");

 

        // -- make sure the path exists

        if(!filesystem::exists(boostdir)) {

            // .. error handle

        }

 

        // -- make sure its a directory

        if(!filesystem::is_directory(boostdir)) {

            // .. error handle

        }

 

        filesystem::directory_iterator enditr;

        for(filesystem::directory_iterator itr(boostdir); itr != enditr; ++itr ) {

           

            if(filesystem::is_directory(*itr))

                // .. code

        }

 

filesystem::is_directory(*itr) throws with

m_what = "boost::filesystem::is_directory: "c:8f876d52712ede0273c42e26d4af6847": The system cannot find the file specified."

 

I checked and verified the folder does exist, I’m guessing the problem is that the directory is in the format c:folder instead of c:\folder.

 

Thanks,

David