#include #include int main() { // "C:\Gehua" is a junction point of "D:\Gehua" fs::path work("d:/Gehua/work"); fs::path work_canonical(fs::canonical(work)); std::wstring s = fs::canonical(work_canonical).native(); // True path passes assert(s == L"d:/Gehua\\work"); // try the junction path fs::path work_junction("c:/Gehua/work"); // this passes assert(fs::exists(work_junction)); s = fs::canonical(work_junction).native(); // this one fails! // s has value "c:/Gehua\\Gehua\\work" assert(s == L"d:/Gehua\\work"); return 0; }