From d90ac405ae50f84a3cf4ba0b806cca1c89f81cff Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 26 Jul 2018 14:12:56 +0300 Subject: Make project variable to be of project_name type --- build2/bash/init.cxx | 2 +- build2/bash/utility.hxx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'build2/bash') diff --git a/build2/bash/init.cxx b/build2/bash/init.cxx index ff653c2..7bfea58 100644 --- a/build2/bash/init.cxx +++ b/build2/bash/init.cxx @@ -54,7 +54,7 @@ namespace build2 // Install into bin// by default stripping the .bash // extension from if present. // - const string& p (cast (rs.vars[var_project])); + const project_name& p (cast (rs.vars[var_project])); install_path (bs, dir_path ("bin") /= project_base (p)); install_mode (bs, "644"); diff --git a/build2/bash/utility.hxx b/build2/bash/utility.hxx index d8d9a43..67f4552 100644 --- a/build2/bash/utility.hxx +++ b/build2/bash/utility.hxx @@ -14,13 +14,12 @@ namespace build2 { // Strip the .bash extension from the project name. // + // Note that the result may not be a valid project name. + // inline string - project_base (const string& n) + project_base (const project_name& pn) { - size_t p (path::traits::find_extension (n)); - return p == string::npos || casecmp (n.c_str () + p, ".bash", 5) != 0 - ? n - : string (n, 0, p); + return pn.base ("bash"); } } } -- cgit v1.1