From 9b51369175da178b8ee04fc43544c75f649af259 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 2 Jul 2018 08:17:46 +0200 Subject: Warn of new executable project name starts with lib prefix --- bdep/new.cxx | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/bdep/new.cxx b/bdep/new.cxx index 1d1b1d3..11f00ee 100644 --- a/bdep/new.cxx +++ b/bdep/new.cxx @@ -110,21 +110,31 @@ namespace bdep // We use the full name for filesystem directories and preprocessor macros // while the stem for modules, namespaces, etc. // - string s; - if (t == type::lib) + string s (n); + switch (t) { - if (n.compare (0, 3, "lib") != 0) + case type::exe: { - warn << "library name does not start with 'lib'" << - info << "this package may not be acceptable to some repositories"; + if (n.compare (0, 3, "lib") == 0) + warn << "executable name starts with 'lib'" << + info << "this package may not be acceptable to some repositories"; - s = n; + break; } - else - s.assign (n, 3, string::npos); + case type::lib: + { + if (n.compare (0, 3, "lib") == 0) + s.erase (0, 3); + else + warn << "library name does not start with 'lib'" << + info << "this package may not be acceptable to some repositories"; + + break; + } + case type::bare: + case type::empty: + break; } - else - s = n; dir_path out; // Project/package output directory. dir_path prj; // Project. -- cgit v1.1