diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-02 13:58:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-02 14:03:55 +0200 |
commit | 9fa4b867890dfaa3fa086affec23049826765dfe (patch) | |
tree | 4643a3cbdf6ebb057e12cd31fd60a71aeda654a2 /build2/algorithm.cxx | |
parent | e45345eeee4db91644a58842267393ff2df19fe2 (diff) |
Fix clean logic
Diffstat (limited to 'build2/algorithm.cxx')
-rw-r--r-- | build2/algorithm.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index 728fb14..d981af0 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -693,22 +693,26 @@ namespace build2 { tracer trace ("inject_fsdir"); - const scope& bs (t.base_scope ()); + // If t is a directory (name is empty), say foo/bar/, then t is bar and + // its parent directory is foo/. + // + const dir_path& d (parent && t.name.empty () ? t.dir.directory () : t.dir); + + const scope& bs (scopes.find (d)); const scope* rs (bs.root_scope ()); - // Handle the outside of any project case. Note that we also used to bail - // our of this is the root of the project. But that proved not to be such - // a great idea in case of subprojects (e.g., tests/). + // If root scope is NULL, then this can mean that we are out of any + // project or if the directory is in src_root. In both cases we don't + // inject anything. + // + // Note that we also used to bail out if this is the root of the + // project. But that proved not to be such a great idea in case of + // subprojects (e.g., tests/). // if (rs == nullptr) return nullptr; - // If t is a directory (name is empty), say foo/bar/, then t is bar and - // its parent directory is foo/. - // - const dir_path& d (parent && t.name.empty () ? t.dir.directory () : t.dir); - - // Handle the src = out. + // Handle the src_root = out_root. // if (d.sub (rs->src_path ())) return nullptr; |