diff options
author | Evan Martin <martine@danga.com> | 2011-04-22 17:49:42 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-04-22 17:49:42 (GMT) |
commit | 20b0b38f10b595dd65ee24855afb484af8dc5185 (patch) | |
tree | 5c69564a9f76f7fae52942d2b83edc99b6717460 /src/parsers.cc | |
parent | 7baaadce1182705754a1605fa25955ea9e8168f0 (diff) | |
download | Ninja-20b0b38f10b595dd65ee24855afb484af8dc5185.zip Ninja-20b0b38f10b595dd65ee24855afb484af8dc5185.tar.gz Ninja-20b0b38f10b595dd65ee24855afb484af8dc5185.tar.bz2 |
use util's CanonicalizePath in parsers as well
Diffstat (limited to 'src/parsers.cc')
-rw-r--r-- | src/parsers.cc | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/parsers.cc b/src/parsers.cc index 2fb2c9a..b9c1190 100644 --- a/src/parsers.cc +++ b/src/parsers.cc @@ -21,6 +21,7 @@ #include "graph.h" #include "ninja.h" +#include "util.h" string Token::AsString() const { switch (type_) { @@ -382,19 +383,6 @@ bool ManifestParser::ParseLet(string* name, string* value, bool expand, return true; } -static string CanonicalizePath(const string& path) { - string out; - for (size_t i = 0; i < path.size(); ++i) { - char in = path[i]; - if (in == '/' && - (!out.empty() && *out.rbegin() == '/')) { - continue; - } - out.push_back(in); - } - return out; -} - bool ManifestParser::ParseEdge(string* err) { vector<string> ins, outs; @@ -494,7 +482,10 @@ bool ManifestParser::ParseEdge(string* err) { string eval_err; if (!eval.Parse(*i, &eval_err)) return tokenizer_.Error(eval_err, err); - *i = CanonicalizePath(eval.Evaluate(env)); + string path = eval.Evaluate(env); + if (!CanonicalizePath(&path, err)) + return false; + *i = path; } } |