aboutsummaryrefslogtreecommitdiff
path: root/build2/name.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-08-30 22:58:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-08-30 23:00:35 +0300
commit631c76d7613458dbef208ca056e194e94a5becf3 (patch)
tree60f9b7b511a2d857e4929d1ed4861a0280361c14 /build2/name.ixx
parent32df5529f791760161a027a1a7408bc92976a3cd (diff)
Make $getenv() to return untyped value
Diffstat (limited to 'build2/name.ixx')
-rw-r--r--build2/name.ixx14
1 files changed, 14 insertions, 0 deletions
diff --git a/build2/name.ixx b/build2/name.ixx
index c77846a..ef59442 100644
--- a/build2/name.ixx
+++ b/build2/name.ixx
@@ -23,4 +23,18 @@ namespace build2
return r;
}
+
+ inline name
+ to_name (string s)
+ {
+ if (!s.empty () && path::traits::is_separator (s.back ()))
+ {
+ dir_path d (move (s), dir_path::exact);
+
+ if (!d.empty ())
+ return name (move (d));
+ }
+
+ return name (move (s));
+ }
}