As per the subject line, I have a rather noobish question about using the boost::filesystem tools, specifically the path object. The idea here is that I want to start my program by removing the "tmp" directory in the current process context if it exists to ensure a clean working environment for the remainder of the process. To the code:
...
boost::filesystem::path tmp_dir ("tmp", boost::filesystem::native); // get a native handle for "./tmp"
boost::filesystem::remove_all (tmp_dir); // clean out this tree in the fs
...
This code acts as expected on linux. On windows, it causes a crash. The debugger shows the tmp_dir.m_path._Bx is a bad pointer, indicating to me that the constructor failed somewhere along the way. My questions are these:
(1) Is there any error checking I can perform to verify that the path() constructor succeeds, such as a null pointer value or a boolean flag within the data type?
(2) Is there something about my code which is linux/POSIX specific?
(3) Am I missing something else entirely?
I'm using boost 1.33.0 and have a mess of other functioning code which suggests that my configuration/installation is correct on both platforms.
Thanks in advance!
-Nick Dimiduk