diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-03-31 15:12:12 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-03-31 19:21:57 (GMT) |
commit | 3beebde51a2089ecb01820f1428efe0263deaeea (patch) | |
tree | 55aec535c37434dbe5893e8ed37c69891b6d4b74 /src/disk_interface.h | |
parent | a88b75d9a9df1b3722ad649ae275d342f3b57b22 (diff) | |
download | Ninja-3beebde51a2089ecb01820f1428efe0263deaeea.zip Ninja-3beebde51a2089ecb01820f1428efe0263deaeea.tar.gz Ninja-3beebde51a2089ecb01820f1428efe0263deaeea.tar.bz2 |
Let Stat() have an err outparam instead of writing to stderr.
Also check for Stat() failure in a few more places.
This way, ninja doesn't print two "ninja: error: " lines if stat() fails
during a build. It also makes it easier to keep the stat tests quiet.
Every caller of Stat() needs to explicitly log the error string if
that's desired.
Diffstat (limited to 'src/disk_interface.h')
-rw-r--r-- | src/disk_interface.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/disk_interface.h b/src/disk_interface.h index a13bced..b61d192 100644 --- a/src/disk_interface.h +++ b/src/disk_interface.h @@ -30,7 +30,7 @@ struct DiskInterface { /// stat() a file, returning the mtime, or 0 if missing and -1 on /// other errors. - virtual TimeStamp Stat(const string& path) const = 0; + virtual TimeStamp Stat(const string& path, string* err) const = 0; /// Create a directory, returning false on failure. virtual bool MakeDir(const string& path) = 0; @@ -56,21 +56,18 @@ struct DiskInterface { /// Implementation of DiskInterface that actually hits the disk. struct RealDiskInterface : public DiskInterface { - RealDiskInterface() : quiet_(false) + RealDiskInterface() #ifdef _WIN32 - , use_cache_(false) + : use_cache_(false) #endif {} virtual ~RealDiskInterface() {} - virtual TimeStamp Stat(const string& path) const; + virtual TimeStamp Stat(const string& path, string* err) const; virtual bool MakeDir(const string& path); virtual bool WriteFile(const string& path, const string& contents); virtual string ReadFile(const string& path, string* err); virtual int RemoveFile(const string& path); - /// Whether to print on errors. Used to make a test quieter. - bool quiet_; - /// Whether stat information can be cached. Only has an effect on Windows. void AllowStatCache(bool allow); |