Problems using boost::filesystem
Hello : I have a question about boost::filesystem::path. My frustration level is growing quickly because I'm getting exceptions when constructing paths such as these : boostfs::path searchPath( "d:/temp", boostfs::native ); boostfs::path searchPath( "d:/temp" ); boostfs::path searchPath( "d:\\temp", boostfs::native ); boostfs::path searchPath( "d:\\temp" ); Looking at the boost test files [at least some of] these appear to be valid. The key seems to be in the method windows_name(...) in path_posix_windows.cpp. This method searches through the array invalid_chars[] which contains "<>:\"/\\|" ... hence the reason why "d:" causes a failure? I've rebuilt the source from the bjam files, tried compiling them into my own code, compiled as a dll etc. to no avail ... Could someone shed some light on this problem before I go even crazier? Thank you kindly in advance; Steve a.
At 03:19 PM 3/3/2005, steve ahlgren wrote:
Hello :
I have a question about boost::filesystem::path. My frustration level is growing quickly because I'm getting exceptions when constructing paths such as these :
boostfs::path searchPath( "d:/temp", boostfs::native ); // #1 boostfs::path searchPath( "d:/temp" ); // #2 boostfs::path searchPath( "d:\\temp", boostfs::native ); // #3 boostfs::path searchPath( "d:\\temp" ); // #4
Assuming you are running on Windows, and have not called path::default_name_check(...), #1 and #3 should be fine, while #2 and #4 should throw an exception.
Looking at the boost test files [at least some of] these appear to be valid.
The key seems to be in the method windows_name(...) in path_posix_windows.cpp. This method searches through the array invalid_chars[] which contains "<>:\"/\\|" ... hence the reason why "d:" causes a failure?
Name checking isn't performed on Windows drive specifiers, and of course drive specifiers are tested extensively in the regression tests.
I've rebuilt the source from the bjam files, tried compiling them into my own code, compiled as a dll etc. to no avail ...
Could someone shed some light on this problem before I go even crazier?
Is it possible that the library thinks you are running on something other than Windows? You might stick a #error directive in some of the ostensibly POSIX-only code in src/path_posix_windows.cpp to verify you are getting the Windows version. What compiler version and standard library are you using? --Beman
participants (2)
-
Beman Dawes
-
steve ahlgren