gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fs::canonical should report an error on empty path

gulrak opened this issue · comments

fs::canonical(...) must handle a non-existent path as an error. As fs::exists("") is false, it is wrong to return the current directory for fs::canonical("").

This change results in fs::weakly_canonical("notfound/foobar") returning fs::path("notfound/foobar"). Changing test results accordingly.

This breaks tests with std::filesystem::weakly_canonical on gcc 8.1.0 and clang 7.0.0, but is matching the results of VS 2017 15.8.5.