diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-24 10:21:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-24 14:52:55 +0200 |
commit | 532e2085deeddd3e94cfbee1ded1e5917aff2b59 (patch) | |
tree | ee7ddd0ed66832b357a48591ce199d83eb106ecd /build | |
parent | 68f96f9213e849d0d7c4cedf3edeaec99743ee27 (diff) |
Add support for reversing project qualification to string value
Diffstat (limited to 'build')
-rw-r--r-- | build/variable.cxx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/build/variable.cxx b/build/variable.cxx index d215b02..03c910d 100644 --- a/build/variable.cxx +++ b/build/variable.cxx @@ -144,6 +144,15 @@ namespace build bool value_traits<string>:: assign (name& n) { + // The below code is quite convoluted because we don't want to + // modify the name until we know it good (if it is not, then it + // will most likely be printed by the caller in diagnostics). + + // Suspend project qualification. + // + const string* p (n.proj); + n.proj = nullptr; + // Convert directory to string. // if (n.directory ()) @@ -158,7 +167,23 @@ namespace build n.value += '/'; } - return n.simple (); + if (!n.simple ()) + { + n.proj = p; // Restore. + return false; + } + + // Convert project qualification to its string representation. + // + if (p != nullptr) + { + string s (*p); + s += '%'; + s += n.value; + s.swap (n.value); + } + + return true; } static bool |