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:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2020-11-24 15:06:41 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2020-11-24 15:06:41 +0300
commit63cfa5af86526937360189594852605d6384dddf (patch)
tree528b38a949946cb3a6d7d588769ab63a0e3f97a4 /include
parentb15941ccbc9a6e77ea2614667c773534f4e6a2e7 (diff)
Add path view special casing for VS2017 Experimental Filesystem.
Diffstat (limited to 'include')
-rw-r--r--include/llfio/revision.hpp6
-rw-r--r--include/llfio/v2.0/path_view.hpp36
2 files changed, 36 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(