mirror of
https://github.com/reactos/ninja.git
synced 2025-02-22 20:52:24 +00:00
Merge pull request #988 from nico/slashes
win: print right slashes in 'unknown target' message
This commit is contained in:
commit
c06fdc8261
@ -347,12 +347,13 @@ bool Edge::use_console() const {
|
||||
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;
|
||||
|
@ -72,8 +72,13 @@ struct Node {
|
||||
|
||||
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_; }
|
||||
|
@ -260,7 +260,7 @@ bool NinjaMain::RebuildManifest(const char* input_file, string* err) {
|
||||
|
||||
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;
|
||||
|
||||
@ -287,8 +287,8 @@ Node* NinjaMain::CollectTarget(const char* cpath, string* err) {
|
||||
}
|
||||
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") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user