aboutsummaryrefslogtreecommitdiff
path: root/build2/parser.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-12-02 15:37:53 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-12-05 17:21:48 +0300
commitcaf24aa705243f87c83d346d803adf84888a3cc5 (patch)
tree9ffded0029a273370033a1cd0531d37929314182 /build2/parser.cxx
parentd04cd568c85262d486f7a0de0a374c80d466c58e (diff)
Eliminate the use of '/...' paths on Windows
Diffstat (limited to 'build2/parser.cxx')
-rw-r--r--build2/parser.cxx36
1 files changed, 14 insertions, 22 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 1d2766c..87ec8b1 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -24,8 +24,6 @@ namespace build2
{
using type = token_type;
- static const dir_path root_dir;
-
class parser::enter_scope
{
public:
@@ -33,33 +31,27 @@ namespace build2
enter_scope (parser& p, dir_path&& d): p_ (&p), r_ (p.root_), s_ (p.scope_)
{
- // Check for the global scope as a special case. Note that the global
- // scope (empty) path is a prefix for any other scope path.
+ // Try hard not to call normalize(). Most of the time we will go just
+ // one level deeper.
//
- if (d != root_dir)
+ bool n (true);
+
+ if (d.relative ())
{
- // Try hard not to call normalize(). Most of the time we will go just
- // one level deeper.
+ // Relative scopes are opened relative to out, not src.
//
- bool n (true);
-
- if (d.relative ())
+ if (d.simple () && d.string () != "." && d.string () != "..")
{
- // Relative scopes are opened relative to out, not src.
- //
- if (d.simple () && d.string () != "." && d.string () != "..")
- {
- d = dir_path (p.scope_->out_path ()) /= d.string ();
- n = false;
- }
- else
- d = p.scope_->out_path () / d;
+ d = dir_path (p.scope_->out_path ()) /= d.string ();
+ n = false;
}
-
- if (n)
- d.normalize ();
+ else
+ d = p.scope_->out_path () / d;
}
+ if (n)
+ d.normalize ();
+
p.switch_scope (d);
}