[libcxx] Handle backslash as path separator on windows
Differential Revision: https://reviews.llvm.org/D91138
GitOrigin-RevId: f4485240a2182050d6417947a407fe4c551e2011
diff --git a/include/filesystem b/include/filesystem
index e39790c..c60020a 100644
--- a/include/filesystem
+++ b/include/filesystem
@@ -1116,7 +1116,12 @@
_LIBCPP_INLINE_VISIBILITY
void clear() noexcept { __pn_.clear(); }
- path& make_preferred() { return *this; }
+ path& make_preferred() {
+#if defined(_LIBCPP_WIN32API)
+ _VSTD::replace(__pn_.begin(), __pn_.end(), L'/', L'\\');
+#endif
+ return *this;
+ }
_LIBCPP_INLINE_VISIBILITY
path& remove_filename() {