summaryrefslogtreecommitdiffstats
path: root/src/graph.cc
diff options
context:
space:
mode:
authorScott Graham <scottmg@chromium.org>2014-11-08 19:47:22 (GMT)
committerScott Graham <scottmg@chromium.org>2014-11-08 19:47:22 (GMT)
commit8177085f4d3adf78b9709069a9c3ce5fe442867a (patch)
tree01d21b186ca671903ad8720c13ea2fa01f82e0fb /src/graph.cc
parent3fb18496c4c2642742df152974d78756d1c9df8a (diff)
downloadNinja-8177085f4d3adf78b9709069a9c3ce5fe442867a.zip
Ninja-8177085f4d3adf78b9709069a9c3ce5fe442867a.tar.gz
Ninja-8177085f4d3adf78b9709069a9c3ce5fe442867a.tar.bz2
path decanonicalization when building command
Diffstat (limited to 'src/graph.cc')
-rw-r--r--src/graph.cc14
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,