summaryrefslogtreecommitdiffstats
path: root/libcxx/include/experimental/filesystem
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/experimental/filesystem')
-rw-r--r--libcxx/include/experimental/filesystem13
1 files changed, 11 insertions, 2 deletions
diff --git a/libcxx/include/experimental/filesystem b/libcxx/include/experimental/filesystem
index 45de0d19cb5..c1427c880e2 100644
--- a/libcxx/include/experimental/filesystem
+++ b/libcxx/include/experimental/filesystem
@@ -863,7 +863,15 @@ public:
}
path& make_preferred() { return *this; }
- path& remove_filename() { return *this = parent_path(); }
+
+ _LIBCPP_INLINE_VISIBILITY
+ path& remove_filename() {
+ if (__pn_.size() == __root_path_raw().size())
+ clear();
+ else
+ __pn_ = __parent_path();
+ return *this;
+ }
path& replace_filename(const path& __replacement) {
remove_filename();
@@ -925,6 +933,7 @@ private:
_LIBCPP_FUNC_VIS int __compare(__string_view) const;
_LIBCPP_FUNC_VIS __string_view __root_name() const;
_LIBCPP_FUNC_VIS __string_view __root_directory() const;
+ _LIBCPP_FUNC_VIS __string_view __root_path_raw() const;
_LIBCPP_FUNC_VIS __string_view __relative_path() const;
_LIBCPP_FUNC_VIS __string_view __parent_path() const;
_LIBCPP_FUNC_VIS __string_view __filename() const;
@@ -953,7 +962,7 @@ public:
_LIBCPP_INLINE_VISIBILITY bool has_root_name() const { return !__root_name().empty(); }
_LIBCPP_INLINE_VISIBILITY bool has_root_directory() const { return !__root_directory().empty(); }
- _LIBCPP_INLINE_VISIBILITY bool has_root_path() const { return !(__root_name().empty() && __root_directory().empty()); }
+ _LIBCPP_INLINE_VISIBILITY bool has_root_path() const { return !__root_path_raw().empty(); }
_LIBCPP_INLINE_VISIBILITY bool has_relative_path() const { return !__relative_path().empty(); }
_LIBCPP_INLINE_VISIBILITY bool has_parent_path() const { return !__parent_path().empty(); }
_LIBCPP_INLINE_VISIBILITY bool has_filename() const { return !__filename().empty(); }
OpenPOWER on IntegriCloud