mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
refs #70, fix for missed issue and mingw errors
This commit is contained in:
parent
56b5e7a174
commit
f15dea9695
@ -184,7 +184,7 @@
|
||||
// * else result of element wise comparison of path iteration where first comparison is != 0 or 0
|
||||
// if all comparisons are 0 (on Windows this implementation does case insensitive root_name()
|
||||
// comparison)
|
||||
// #define LWG_2936_BEHAVIOUR
|
||||
#define LWG_2936_BEHAVIOUR
|
||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// LWG #2937 enforces that fs::equivalent emits an error, if !fs::exists(p1)||!exists(p2)
|
||||
#define LWG_2937_BEHAVIOUR
|
||||
@ -2719,10 +2719,13 @@ GHC_INLINE int path::compare(const path& p) const noexcept
|
||||
auto rnl1 = root_name_length();
|
||||
auto rnl2 = p.root_name_length();
|
||||
auto rnc = detail::compare_simple_insensitive(_path.c_str(), rnl1, p._path.c_str(), rnl2);
|
||||
if(rnc) {
|
||||
return rnc;
|
||||
}
|
||||
auto p1 = _path;
|
||||
std::replace(p1.begin()+rnl1, p1.end(), '/', '\\');
|
||||
std::replace(p1.begin()+static_cast<int>(rnl1), p1.end(), '/', '\\');
|
||||
auto p2 = p._path;
|
||||
std::replace(p2.begin()+rnl2, p2.end(), '/', '\\');
|
||||
std::replace(p2.begin()+static_cast<int>(rnl2), p2.end(), '/', '\\');
|
||||
return p1.compare(rnl1, std::string::npos, p2, rnl2, std::string::npos);
|
||||
#else
|
||||
return _path.compare(p._path);
|
||||
|
@ -618,6 +618,7 @@ TEST_CASE("30.10.8.4.8 path compare", "[filesystem][path][fs.path.compare]")
|
||||
|
||||
#ifdef GHC_OS_WINDOWS
|
||||
CHECK(fs::path("c:\\a\\b").compare("C:\\a\\b") == 0);
|
||||
CHECK(fs::path("c:\\a\\b").compare("d:\\a\\b") != 0);
|
||||
CHECK(fs::path("c:\\a\\b").compare("C:\\A\\b") != 0);
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user