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;
Regards
Fernando Gomes.

2016-11-10 18:05 GMT-02:00 Christopher J. Pisz <cpisz@austin.rr.com>:

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/portability_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@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users