Reputation: 128
Given the following code:
fs::path p{ "a/b/" };
fs::path q{ "a/b/." };
assert(p == q);
[Note the extra dot at the end of the string defining q.]
With the above, boost::filesystem accepts p == q as true, but gcc's and llvm's implementation of std::filesystem say it is false.
Why the discrepancy between boost and std?
P.S. In previous versions of this question, I erroneously thought that the paths were supposed to be normalized before comparison. That is not the case. Even so, the discrepancy between boost and std is still a mystery to me.
Upvotes: 3
Views: 742
Reputation: 1009
The short answer is that .
on Unix is an actual filesystem node link, and that matters sometimes. See this stack overflow answer.
EDIT
However, I can't presume to know the Standard Committee's intentions with regard to filesystem library behavior, nor do I think it's reasonable for the library to know that much about Unix symlink behavior. In short, this may or may not just be a quirk of the Standard wording vs Boost's opinion of how things should work.
Upvotes: 1