Boost :: filesystem :: path :: lexically_normal: is this the wrong behavior?

The documentation boost::filesystem::path::lexically_normal()reads:

Returns *thiswith the current directory (point) deleted, the parent directory (point-to-point), and directory separator elements removed.

See http://www.boost.org/doc/libs/1_63_0/libs/filesystem/doc/reference.html .

The following prints ./test(using Boost 1.63.0), where I expected test:

#include <boost/filesystem/path.hpp>
#include <iostream>

int main(void)
{
   std::cout << boost::filesystem::path{"./test"}.lexically_normal().string() << "\n";
   return 0;
}

Thus, the first point element is not considered redundant. Nevertheless, as testit is ./testobvious, they allow the same file when using the boost file system, so it seems contradictory to me. Is this expected behavior?

: ++ 17 "test" (GCC 8.2.0, Linux).

+6
1

, , , test ./test , .

, ./test , . test, (, $PATH).

test ./test , ./ .

+1

Source: https://habr.com/ru/post/1015934/


All Articles