diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-07-17 14:49:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-07-17 14:49:04 +0200 |
commit | 1580b9fe0ab2b242227cdd7601766bdfce5493e2 (patch) | |
tree | e06a0c32d76865fb232a82cf390f8728ddfe8b1a /bdep/new.cxx | |
parent | c70cc15b6ebe49150661e025855dc22ceb235905 (diff) |
Diagnose improper project/package arrangements in new command
Diffstat (limited to 'bdep/new.cxx')
-rw-r--r-- | bdep/new.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx index 37a7b67..2b5402b 100644 --- a/bdep/new.cxx +++ b/bdep/new.cxx @@ -158,6 +158,26 @@ namespace bdep fail << "package directory " << out << " is not a subdirectory of " << "project directory " << prj; + // As a sanity check, verify none of the directories between us and the + // project look like packages. + // + project_package pp ( + find_project_package (out, true /* ignore_not_found */)); + + if (!pp.project.empty ()) + { + if (pp.project != prj) + fail << prj << " is not a project directory" << + info << pp.project << " looks like a project directory"; + + if (pp.package) + fail << "package directory " << out << " is inside another " + << "package directory " << prj / *pp.package << + info << "nested packages are not allowed"; + } + else + warn << prj << " does not look like a project directory"; + pkg = out.leaf (prj); } else @@ -167,8 +187,8 @@ namespace bdep prj = out; } - // If the output directory already exists, make sure it is - // empty. Otherwise create it. + // If the output directory already exists, make sure it is empty. + // Otherwise create it. // if (!exists (out)) mk (out); |