
17 Apr
2007
17 Apr
'07
9:45 p.m.
Why does the following path initialization throw this? "boost::filesystem::path: invalid name "c:" in path: "c:/dev/Sandbox/file_system/ textfile1.txt" How do you set paths that should work on windows and linux without avoiding this issue? Since linux doesn't have drive like C: D: and etc? try { // Is this not an appropriate method to initialize path objects? path text_file(current_path().string() + "/textfile1.txt"); if (exists(text_file)) { cout << file_size(text_file) << endl; } } catch (const filesystem_error& e) { cout << e.what() << endl; } I am running this under windows. Thanks, Graham