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...
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.h...
I then write myself a test:
#include <iostream>
#include <sstream>
#include
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?