diff options
author | Evan Martin <martine@danga.com> | 2011-04-22 17:58:40 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-04-22 17:58:40 (GMT) |
commit | 4f6ad36ebde27874f4aa054de0fa00e06ff166fe (patch) | |
tree | 4c53b5a3275af72ca29176077e3f2a310bbbf190 /src | |
parent | 20b0b38f10b595dd65ee24855afb484af8dc5185 (diff) | |
download | Ninja-4f6ad36ebde27874f4aa054de0fa00e06ff166fe.zip Ninja-4f6ad36ebde27874f4aa054de0fa00e06ff166fe.tar.gz Ninja-4f6ad36ebde27874f4aa054de0fa00e06ff166fe.tar.bz2 |
canonicalize paths on the command-line as they're used
I'm not entirely happy with my solution. I think Ninja should
always use canonicalized paths internally, so we should canonicalize
all paths as we receive them (from the command line and from build
files). But there are other places where we pass paths around
(like in all the tool commands) and I don't want to add manual calls
to canonicalize in each.
Perhaps the longer-term solution is to add some sort of
GetNodeCanonicalize() to State and then make all of the functions that
work with paths as strings (like Builder::AddTarget or RunBrowsePython)
instead only accept a Node*.
Diffstat (limited to 'src')
-rw-r--r-- | src/ninja.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ninja.cc b/src/ninja.cc index 35d25e0..de2ef42 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -226,7 +226,12 @@ int main(int argc, char** argv) { Builder builder(&state, config); for (int i = 0; i < argc; ++i) { - if (!builder.AddTarget(argv[i], &err)) { + string path = argv[i]; + string err; + if (!CanonicalizePath(&path, &err)) + Fatal("can't canonicalize '%s': %s", path.c_str(), err.c_str()); + + if (!builder.AddTarget(path, &err)) { if (!err.empty()) { Error("%s", err.c_str()); return 1; |