Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llfio/revision.hpp6
-rw-r--r--include/llfio/v2.0/path_view.hpp36
-rw-r--r--test/tests/path_view.cpp8
3 files changed, 44 insertions, 6 deletions
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp
index 749b110e..0c472f78 100644
--- a/include/llfio/revision.hpp
+++ b/include/llfio/revision.hpp
@@ -1,4 +1,4 @@
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
-#define LLFIO_PREVIOUS_COMMIT_REF 152d46c9f7bb0dd793eda3d606c56c4b6afda8dc
-#define LLFIO_PREVIOUS_COMMIT_DATE "2020-11-20 14:34:08 +00:00"
-#define LLFIO_PREVIOUS_COMMIT_UNIQUE 152d46c9
+#define LLFIO_PREVIOUS_COMMIT_REF b15941ccbc9a6e77ea2614667c773534f4e6a2e7
+#define LLFIO_PREVIOUS_COMMIT_DATE "2020-11-23 12:23:16 +00:00"
+#define LLFIO_PREVIOUS_COMMIT_UNIQUE b15941cc
diff --git a/include/llfio/v2.0/path_view.hpp b/include/llfio/v2.0/path_view.hpp
index 8c0df8b4..0dbf538f 100644
--- a/include/llfio/v2.0/path_view.hpp
+++ b/include/llfio/v2.0/path_view.hpp
@@ -556,14 +556,29 @@ private:
LLFIO_PATH_VIEW_CONSTEXPR path_view_component _filename() const noexcept
{
auto sep_idx = _find_last_sep();
- if(_npos == sep_idx
#if LLFIO_USING_EXPERIMENTAL_FILESYSTEM
- || (_length == 1 && sep_idx == 0) // Filesystem TS thinks the filename() of "/" is "/"
+#ifdef _WIN32
+ if(sep_idx == 2 && _length == 3)
+ {
+ return this->_invoke([this, sep_idx](const auto &v) mutable {
+ if(v[1] == ':')
+ {
+ return path_view_component(v.data() + 2, 1, zero_termination(), formatting());
+ }
+ return *this;
+ });
+ }
#endif
- )
+ if(_npos == sep_idx || (_length == 1 && sep_idx == 0)) // Filesystem TS thinks the filename() of "/" is "/"
+ {
+ return *this;
+ }
+#else
+ if(_npos == sep_idx)
{
return *this;
}
+#endif
return _invoke([sep_idx, this](const auto &v) { return path_view_component(v.data() + sep_idx + 1, v.size() - sep_idx - 1, zero_termination()); });
}
@@ -1824,12 +1839,23 @@ public:
auto sep_idx = this->_find_last_sep();
if(_npos == sep_idx)
{
+#if LLFIO_USING_EXPERIMENTAL_FILESYSTEM && defined(_MSC_VER)
+ return this->_invoke([&](const auto &v) {
+ // MSVC's Experimental Filesystem has some really, really weird semantics :(
+ return *this;
+ });
+#else
return path_view();
+#endif
}
return this->_invoke([sep_idx, this](auto v) {
return path_view(v.data(),
#if LLFIO_USING_EXPERIMENTAL_FILESYSTEM
+#ifdef _MSC_VER
+ (sep_idx > 3 && (!is_uncpath() || v.data()[2] == '.' || v.data()[2] == '?')) ? sep_idx : (sep_idx + 1)
+#else
(v.size() - 1 == sep_idx) ? sep_idx : (sep_idx + 1)
+#endif
#else
(sep_idx + 1)
#endif
@@ -1971,6 +1997,7 @@ public:
return path_view(v.data(), sep_idx + 1, not_zero_terminated, formatting());
}
}
+#if !LLFIO_USING_EXPERIMENTAL_FILESYSTEM
// If a C:\ or whatever, return exactly that.
auto rp = root_path();
if(rp.native_size() == native_size())
@@ -1978,6 +2005,9 @@ public:
return *this;
}
return path_view(v.data(), (sep_idx == 0) ? 1 : sep_idx, not_zero_terminated, formatting());
+#else
+ return path_view(v.data(), (sep_idx == 0 && this->_length > 1) ? 1 : sep_idx, not_zero_terminated, formatting());
+#endif
});
#elif LLFIO_USING_EXPERIMENTAL_FILESYSTEM // Filesystem TS returns parent path "" for "/"
return this->_invoke(
diff --git a/test/tests/path_view.cpp b/test/tests/path_view.cpp
index 4d4008f6..7e051462 100644
--- a/test/tests/path_view.cpp
+++ b/test/tests/path_view.cpp
@@ -115,7 +115,11 @@ static inline void TestPathView()
llfio::path_view e(p); // NOLINT
llfio::path_view f(e.filename());
e = e.remove_filename();
+#if LLFIO_USING_EXPERIMENTAL_FILESYSTEM && defined(_MSC_VER)
+ BOOST_CHECK(0 == e.compare<>("/mnt/c/Users/ned/Documents/boostish/afio/programs/build_posix/testdir"));
+#else
BOOST_CHECK(0 == e.compare<>("/mnt/c/Users/ned/Documents/boostish/afio/programs/build_posix/testdir/"));
+#endif
BOOST_CHECK(0 == f.compare<>("0"));
// Trailing
BOOST_CHECK(0 == llfio::path_view("/a/b/").without_trailing_separator().compare<>("/a/b"));
@@ -166,7 +170,11 @@ static inline void TestPathView()
llfio::path_view g(p2);
llfio::path_view h(g.filename());
g = g.remove_filename();
+#if LLFIO_USING_EXPERIMENTAL_FILESYSTEM && defined(_MSC_VER)
+ BOOST_CHECK(0 == g.compare<>("\\mnt\\c\\Users\\ned\\Documents\\boostish\\afio\\programs\\build_posix\\testdir"));
+#else
BOOST_CHECK(0 == g.compare<>("\\mnt\\c\\Users\\ned\\Documents\\boostish\\afio\\programs\\build_posix\\testdir\\"));
+#endif
BOOST_CHECK(0 == h.compare<>("0"));
// cstr
llfio::path_view::c_str<> i(g, llfio::path_view::zero_terminated);