return pool() == &State::kConsolePool;
}
-string Node::PathDecanonicalized() const {
- string result = path_;
+// static
+string Node::PathDecanonicalized(const string& path, unsigned int slash_bits) {
+ string result = path;
#ifdef _WIN32
unsigned int mask = 1;
for (char* c = &result[0]; (c = strchr(c, '/')) != NULL;) {
- if (slash_bits_ & mask)
+ if (slash_bits & mask)
*c = '\\';
c++;
mask <<= 1;
const string& path() const { return path_; }
/// Get |path()| but use slash_bits to convert back to original slash styles.
- string PathDecanonicalized() const;
+ string PathDecanonicalized() const {
+ return PathDecanonicalized(path_, slash_bits_);
+ }
+ static string PathDecanonicalized(const string& path,
+ unsigned int slash_bits);
unsigned int slash_bits() const { return slash_bits_; }
+
TimeStamp mtime() const { return mtime_; }
bool dirty() const { return dirty_; }
Node* NinjaMain::CollectTarget(const char* cpath, string* err) {
string path = cpath;
- unsigned int slash_bits; // Unused because this path is only used for lookup.
+ unsigned int slash_bits;
if (!CanonicalizePath(&path, &slash_bits, err))
return NULL;
}
return node;
} else {
- *err = "unknown target '" + path + "'";
-
+ *err =
+ "unknown target '" + Node::PathDecanonicalized(path, slash_bits) + "'";
if (path == "clean") {
*err += ", did you mean 'ninja -t clean'?";
} else if (path == "help") {