aboutsummaryrefslogtreecommitdiff
path: root/butl/path.txx
diff options
context:
space:
mode:
Diffstat (limited to 'butl/path.txx')
-rw-r--r--butl/path.txx31
1 files changed, 23 insertions, 8 deletions
diff --git a/butl/path.txx b/butl/path.txx
index 35c6956..94fbd90 100644
--- a/butl/path.txx
+++ b/butl/path.txx
@@ -61,16 +61,31 @@ namespace butl
if (r.absolute () && !this->path_.empty ()) // Allow ('' / '/foo').
throw invalid_basic_path<C> (r.path_);
- if (this->path_.empty () || r.path_.empty ())
- {
- this->path_ += r.path_;
- return *this;
- }
+ combine (r.path_.c_str (), r.path_.size ());
+ return *this;
+ }
+
+ template <typename C, typename K>
+ basic_path<C, K>& basic_path<C, K>::
+ operator/= (string_type const& r)
+ {
+ if (traits::find_separator (r) != string_type::npos)
+ throw invalid_basic_path<C> (r);
+
+ combine (r.c_str (), r.size ());
+ return *this;
+ }
+
+ template <typename C, typename K>
+ basic_path<C, K>& basic_path<C, K>::
+ operator/= (const C* r)
+ {
+ size_type rn (string_type::traits_type::length (r));
- if (!traits::is_separator (this->path_[this->path_.size () - 1]))
- this->path_ += traits::directory_separator;
+ if (traits::find_separator (r, rn) != nullptr)
+ throw invalid_basic_path<C> (r);
- this->path_ += r.path_;
+ combine (r, rn);
return *this;
}