代码没有任何用处。只是尝试并使用错误代码来找出正在发生的事情:
fs::path path("e:\\Σtest");
cout<<path << " exsits="<< fs::exists(path) << " is dir=" << fs::is_directory(path) << std::endl;
fs::path pathL(L"e:\\Σtest");
cout<<pathL << " exsits="<< fs::exists(pathL) << " is dir=" << fs::is_directory(pathL) << std::endl;
fs::path pathu(u"e:\\Σtest");
cout<<pathu << " exsits="<< fs::exists(pathu) << " is dir=" << fs::is_directory(pathu) << std::endl;
输出:
e:\Σtest exsits=0 is dir=0
e:\Σtest exsits=0 is dir=0
e:\Σtest exsits=0 is dir=0
我确定文件夹Σtest
存在。我猜有编码涉及某种方式。我无法弄清楚我们在这里遇到了什么复杂的问题,有人可以解释输出吗?
编辑:
遵循@cpplearner建议将/utf-8
传递给编译器输出更改(控制台的代码页也被chcp 65001
更改为utf-8):
e:\Σtest exsits=0 is dir=0
e:\?test exsits=1 is dir=1
e:\?test exsits=1 is dir=1
问题依旧,这里发生了什么魔术?