aboutsummaryrefslogtreecommitdiff
path: root/bdep
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-02 08:17:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-02 08:17:46 +0200
commit9b51369175da178b8ee04fc43544c75f649af259 (patch)
tree6461fc1713196990f179ff4f2dca06ba4eaae3f9 /bdep
parent9e77628f4fe1feeea7560cbd4db49b54427f3d6f (diff)
Warn of new executable project name starts with lib prefix
Diffstat (limited to 'bdep')
-rw-r--r--bdep/new.cxx30
1 files 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.