Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::filesystem::native
From: Fernando Gomes da Silva (fernandogs1989_at_[hidden])
Date: 2016-11-10 15:19:18


can you try it:

std::cout << boost::filesystem::native("C://PATH") << std::endl;
std::cout << boost::filesystem::native("C:/PATH") << std::endl;
std::cout << boost::filesystem::native("C:\\PATH") << std::endl;
std::cout << boost::filesystem::native("C:\PATH") << std::endl;
std::cout << boost::filesystem::native("\PATH") << std::endl;
std::cout << boost::filesystem::native("\\PATH") << std::endl;
std::cout << boost::filesystem::native("/PATH") << std::endl;
std::cout << boost::filesystem::native("//PATH") << std::endl;

RegardsFernando Gomes.

2016-11-10 18:05 GMT-02:00 Christopher J. Pisz <cpisz_at_[hidden]>:

>
> I did a Google search to see how to check if a given path is valid,
> preferably using boost.
>
> It brought me here:
>
> http://stackoverflow.com/questions/10426671/how-to-check-if-
> path-is-valid-in-boostfilesystem
>
> Great! I say to myself.
> I then Google up the boost doc here:
> http://www.boost.org/doc/libs/1_62_0/libs/filesystem/doc/por
> tability_guide.htm
>
> I then write myself a test:
>
>
>
> #include <iostream>
> #include <sstream>
>
> #include <boost/filesystem.hpp>
>
> int main()
> {
> const std::string test1 = "D:\\Programing Projects\\Git
> Workspace\\Common\\x64\\Debug";
> const std::string test2 = "D:\Programing Projects\\Git
> Workspace\\Common\\x64\\Debug\\";
> const std::string test3 = "D:/Programing Projects/Git
> Workspace/Common/x64/Debug";
> const std::string test4 = "D:/Programing Projects/Git
> Workspace/Common/x64/Debug/";
>
> if (!boost::filesystem::native(test1))
> {
> std::cout << "Boost says the following path is not valid for
> the native operating system: " << test1 << std::endl;
> }
>
> if (!boost::filesystem::native(test2))
> {
> std::cout << "Boost says the following path is not valid for
> the native operating system: " << test2 << std::endl;
> }
>
> if (!boost::filesystem::native(test3))
> {
> std::cout << "Boost says the following path is not valid for the
> native operating system: " << test3 << std::endl;
> }
>
> if (!boost::filesystem::native(test4))
> {
> std::cout << "Boost says the following path is not valid for
> the native operating system: " << test4 << std::endl;
>
> }
>
> return 0;
> }
>
> The Test's Output:
>
> Boost says the following path is not valid for the native operating
> system: D:\Programing Projects\Git Workspace\Common\x64\Debug
> Boost says the following path is not valid for the native operating
> system: D:Programing Projects\Git Workspace\Common\x64\Debug\
> Boost says the following path is not valid for the native operating
> system: D:/Programing Projects/Git Workspace/Common/x64/Debug
> Boost says the following path is not valid for the native operating
> system: D:/Programing Projects/Git Workspace/Common/x64/Debug/
>
> What is wrong with that path that it says it is not valid for my native
> Windows 10 operating system?
>
> _______________________________________________
> 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