From b11aaa16d404ce7dc55de6b7338dccbf053a72bd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 28 Jul 2016 07:17:29 +0200 Subject: Adjust to new path implementation, use to support reversibility --- build2/variable.cxx | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'build2/variable.cxx') diff --git a/build2/variable.cxx b/build2/variable.cxx index 7a333bb..2d4db86 100644 --- a/build2/variable.cxx +++ b/build2/variable.cxx @@ -436,16 +436,13 @@ namespace build2 string s; if (n.directory (true)) - { - s = move (n.dir).string (); // Move string out of path. - - // Add / back to the end of the path unless it is already there. Note - // that the string cannot be empty (n.directory () would have been - // false). + // Use either the precise or traditional representation depending on + // whethe this is the original name (if it is, then this might not be + // a path after all; think s/foo/bar/). // - if (!dir_path::traits::is_separator (s[s.size () - 1])) - s += '/'; - } + s = n.original + ? move (n.dir).representation () // Move out of path. + : move (n.dir).string (); else s.swap (n.value); @@ -473,10 +470,10 @@ namespace build2 if (r->directory (true)) { - s += r->dir.string (); - - if (!dir_path::traits::is_separator (s[s.size () - 1])) - s += '/'; + if (r->original) + s += move (r->dir).representation (); + else + s += r->dir.string (); } else s += r->value; @@ -636,6 +633,7 @@ namespace build2 if (r != nullptr) throw invalid_argument (string ()); + n.original = false; return move (n); } -- cgit v1.1