|
Boost Users : |
From: Graham Reitz (graham.cpp_at_[hidden])
Date: 2007-04-17 20:26:16
Excellent, thanks, that helped. Is that an acceptable method to do this?
(using boost::filesystem::native)
Or are there other preferred methods of setting up path objects?
Graham
On 4/17/07, Rush Manbert <rush_at_[hidden]> wrote:
>
> Graham Reitz wrote:
> > 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.
> >
> I think you need to use the native name checker like this:
>
> path text_file(current_path().string() + "/textfile1.txt",
> boost::filesystem::native);
>
> - Rush
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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