15 #ifndef NINJA_DISK_INTERFACE_H_
16 #define NINJA_DISK_INTERFACE_H_
38 std::string* err) = 0;
48 virtual TimeStamp Stat(
const std::string& path, std::string* err)
const = 0;
51 virtual bool MakeDir(
const std::string& path) = 0;
57 virtual bool WriteFile(
const std::string& path,
const std::string& contents,
58 bool crlf_on_windows) = 0;
69 bool MakeDirs(
const std::string& path);
76 TimeStamp Stat(
const std::string& path, std::string* err)
const override;
77 bool MakeDir(
const std::string& path)
override;
78 bool WriteFile(
const std::string& path,
const std::string& contents,
79 bool crlf_on_windows)
override;
81 std::string* err)
override;
82 int RemoveFile(
const std::string& path)
override;
89 bool AreLongPathsEnabled()
const;
98 bool long_paths_enabled_;
100 typedef std::map<std::string, TimeStamp> DirCache;
103 typedef std::map<std::string, DirCache> Cache;
104 mutable Cache cache_;
Interface for accessing the disk.
virtual bool WriteFile(const std::string &path, const std::string &contents, bool crlf_on_windows)=0
Create a file, with the specified name and contents If crlf_on_windows is true, will be converted t...
virtual bool MakeDir(const std::string &path)=0
Create a directory, returning false on failure.
bool MakeDirs(const std::string &path)
Create all the parent directories for path; like mkdir -p basename path.
virtual int RemoveFile(const std::string &path)=0
Remove the file named path.
virtual TimeStamp Stat(const std::string &path, std::string *err) const =0
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
Interface for reading files from disk.
virtual Status ReadFile(const std::string &path, std::string *contents, std::string *err)=0
Read and store in given string.
Implementation of DiskInterface that actually hits the disk.
Status ReadFile(const std::string &path, std::string *contents, std::string *err) override
Read and store in given string.
void AllowStatCache(bool allow)
Whether stat information can be cached. Only has an effect on Windows.
bool WriteFile(const std::string &path, const std::string &contents, bool crlf_on_windows) override
Create a file, with the specified name and contents If crlf_on_windows is true, will be converted t...
virtual ~RealDiskInterface()
int RemoveFile(const std::string &path) override
Remove the file named path.
TimeStamp Stat(const std::string &path, std::string *err) const override
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
bool MakeDir(const std::string &path) override
Create a directory, returning false on failure.
Abstract interface to object that tracks the status of a build: completion fraction,...