summaryrefslogtreecommitdiffstats
path: root/src/disk_interface.cc
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-03 18:20:00 (GMT)
committerBrad King <brad.king@kitware.com>2016-02-03 18:42:18 (GMT)
commit858386d8415d2ee932fe3c01ebfbe5e0737f94a3 (patch)
tree794bd049a0217fda35c9dd3be483cca03cd3367b /src/disk_interface.cc
parentf9487ac7971a668ddf142d5adc741f789c7bbb68 (diff)
downloadNinja-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/disk_interface.cc')
-rw-r--r--src/disk_interface.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/disk_interface.cc b/src/disk_interface.cc
index 70282c0..451a9b4 100644
--- a/src/disk_interface.cc
+++ b/src/disk_interface.cc
@@ -229,14 +229,14 @@ bool RealDiskInterface::MakeDir(const string& path) {
return true;
}
-string RealDiskInterface::ReadFile(const string& path, string* err) {
- string contents;
- int ret = ::ReadFile(path, &contents, err);
- if (ret == -ENOENT) {
- // Swallow ENOENT.
- err->clear();
+FileReader::Status RealDiskInterface::ReadFile(const string& path,
+ string* contents,
+ string* err) {
+ switch (::ReadFile(path, contents, err)) {
+ case 0: return Okay;
+ case -ENOENT: return NotFound;
+ default: return OtherError;
}
- return contents;
}
int RealDiskInterface::RemoveFile(const string& path) {