|
Ninja
|
Interface for accessing the disk. More...
#include <disk_interface.h>

Public Types | |
| enum | Status { Okay , NotFound , OtherError } |
| Result of ReadFile. More... | |
Public Member Functions | |
| virtual bool | MakeDir (const std::string &path)=0 |
| Create a directory, returning false on failure. More... | |
| bool | MakeDirs (const std::string &path) |
Create all the parent directories for path; like mkdir -p basename path. More... | |
| virtual Status | ReadFile (const std::string &path, std::string *contents, std::string *err)=0 |
| Read and store in given string. More... | |
| virtual int | RemoveFile (const std::string &path)=0 |
| Remove the file named path. More... | |
| 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. More... | |
| 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 to \r (only on Windows builds of Ninja). More... | |
Interface for accessing the disk.
Abstract so it can be mocked out for tests. The real implementation is RealDiskInterface.
Definition at line 45 of file disk_interface.h.
|
inherited |
Result of ReadFile.
| Enumerator | |
|---|---|
| Okay | |
| NotFound | |
| OtherError | |
Definition at line 29 of file disk_interface.h.
|
pure virtual |
Create a directory, returning false on failure.
Implemented in VirtualFileSystem, and RealDiskInterface.
| bool DiskInterface::MakeDirs | ( | const std::string & | path | ) |
Create all the parent directories for path; like mkdir -p basename path.
Definition at line 140 of file disk_interface.cc.
References Error().
Referenced by Builder::StartEdge().
|
pure virtualinherited |
Read and store in given string.
On success, return Okay. On error, return another Status and fill |err|.
Implemented in VirtualFileSystem, and RealDiskInterface.
Referenced by Builder::ExtractDeps().
|
pure virtual |
Remove the file named path.
It behaves like 'rm -f path' so no errors are reported if it does not exists.
Implemented in VirtualFileSystem, and RealDiskInterface.
Referenced by Builder::Cleanup(), Builder::ExtractDeps(), Builder::FinishCommand(), and Cleaner::RemoveFile().
|
pure virtual |
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
Implemented in VirtualFileSystem, and RealDiskInterface.
Referenced by Builder::Cleanup(), Cleaner::FileExists(), Builder::FinishCommand(), BuildLog::Restat(), Builder::StartEdge(), and Node::Stat().
|
pure virtual |
Create a file, with the specified name and contents If crlf_on_windows is true,
will be converted to \r
(only on Windows builds of Ninja).
Returns true on success, false on failure
Implemented in VirtualFileSystem, and RealDiskInterface.
Referenced by Builder::StartEdge().