diff options
author | Brad King <brad.king@kitware.com> | 2016-02-03 18:20:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-02-03 18:42:18 (GMT) |
commit | 858386d8415d2ee932fe3c01ebfbe5e0737f94a3 (patch) | |
tree | 794bd049a0217fda35c9dd3be483cca03cd3367b /src/graph.cc | |
parent | f9487ac7971a668ddf142d5adc741f789c7bbb68 (diff) | |
download | Ninja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.zip Ninja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.tar.gz Ninja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.tar.bz2 |
Expose more details in FileReader::ReadFile signature
Return a status so callers can distinguish a missing file from an empty
file. This allows our VirtualFileSystem test infrastructure to report
as missing any file for which it has no entry.
Diffstat (limited to 'src/graph.cc')
-rw-r--r-- | src/graph.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/graph.cc b/src/graph.cc index 9e65675..98f1461 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -395,8 +395,15 @@ bool ImplicitDepLoader::LoadDeps(Edge* edge, string* err) { bool ImplicitDepLoader::LoadDepFile(Edge* edge, const string& path, string* err) { METRIC_RECORD("depfile load"); - string content = disk_interface_->ReadFile(path, err); - if (!err->empty()) { + // Read depfile content. Treat a missing depfile as empty. + string content; + switch (disk_interface_->ReadFile(path, &content, err)) { + case DiskInterface::Okay: + break; + case DiskInterface::NotFound: + err->clear(); + break; + case DiskInterface::OtherError: *err = "loading '" + path + "': " + *err; return false; } |