aboutsummaryrefslogtreecommitdiff
path: root/libbutl
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-04-26 09:39:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-04-26 09:39:50 +0200
commitb32579bad74e1b7f3a719fa49aad8566d20a6d2b (patch)
treec85f5367dc95108411ff10ffb22c4b2cf39db6b8 /libbutl
parent53e82a43a563992986c50089f6af765fa5cff526 (diff)
Relax path combination requirement for LHS to contain trailing slash
Now if there is no slash, we automatically add the canonical one. This allows (natural) code like this: path f (d / "foo" / "bar");
Diffstat (limited to 'libbutl')
-rw-r--r--libbutl/path.ixx2
-rw-r--r--libbutl/path.mxx4
2 files changed, 3 insertions, 3 deletions
diff --git a/libbutl/path.ixx b/libbutl/path.ixx
index b754bed..aef38eb 100644
--- a/libbutl/path.ixx
+++ b/libbutl/path.ixx
@@ -423,7 +423,7 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason.
//
switch (ts)
{
- case 0: if (!l.empty ()) throw invalid_basic_path<C> (l); break;
+ case 0: if (!l.empty ()) l += path_traits<C>::directory_separator; break;
case -1: break; // Already in the string.
default: l += path_traits<C>::directory_separators[ts - 1];
}
diff --git a/libbutl/path.mxx b/libbutl/path.mxx
index dfc634b..ab85a0f 100644
--- a/libbutl/path.mxx
+++ b/libbutl/path.mxx
@@ -1104,7 +1104,7 @@ LIBBUTL_MODEXPORT namespace butl
using base_type::_size;
using base_type::_init;
- // Common implementation for operator/= and operator+=.
+ // Common implementation for operator/=.
//
void
combine (const C*, size_type, difference_type);
@@ -1197,7 +1197,7 @@ LIBBUTL_MODEXPORT namespace butl
// Note that the result of (foo / "bar") is always a path, even if foo
- // is dir_path. An idiom to force it dir_path is this:
+ // is dir_path. An idiom to force it to dir_path is:
//
// dir_path foo_bar (dir_path (foo) /= "bar");
//