My issue is something like the following: to determine if two paths are identical on the windows platform, paths are compared case insensitive, ei. "C:\test.txt" and "C:\Test.txt" resolves to the same file element. I could solve this easily by using std::filesystem::equal
for example, but for this particular problem I would like to save a bit on OS roundtripping (running on idle and doing 100+ compares on each loop - I am fearfull it is going to be noticeable)
using path = std::filesystem::path;
const bool result = (path("C:\\test.txt").lexically_normal().make_preferred().native() == path("C:\\Test.txt").lexically_normal().make_preferred().native());
When comparing std::filesystem::path
, even when lexically normalized by calling lexical_normal
are done in the generic way and thus the case is considered. This makes sense of course, but aside from doing string compare myself I do not see a way to do this with the library without comparing: is it possible to somehow override how paths are compared ?
I also looked into boost::filesystem
, but as far as i could see does not address the issue either.