diff options
Diffstat (limited to 'src/graph.cc')
-rw-r--r-- | src/graph.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/graph.cc b/src/graph.cc index aa9c0e8..5bc5c00 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -256,7 +256,7 @@ string EdgeEnv::MakePathList(vector<Node*>::iterator begin, for (vector<Node*>::iterator i = begin; i != end; ++i) { if (!result.empty()) result.push_back(sep); - const string& path = (*i)->path(); + const string& path = (*i)->PathDecanonicalized(); if (escape_in_out_ == kShellEscape) { #if _WIN32 GetWin32EscapedString(path, &result); @@ -328,6 +328,18 @@ bool Edge::use_console() const { return pool() == &State::kConsolePool; } +string Node::PathDecanonicalized() const { + string result = path_; + unsigned int mask = 1; + for (char* c = &result[0]; (c = strpbrk(c, "/\\")) != NULL;) { + if (slash_bits_ & mask) + *c = '\\'; + c++; + mask <<= 1; + } + return result; +} + void Node::Dump(const char* prefix) const { printf("%s <%s 0x%p> mtime: %d%s, (:%s), ", prefix, path().c_str(), this, |