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

Public Member Functions | |
| virtual bool | MakeDir (const string &path)=0 |
| Create a directory, returning false on failure. | |
| bool | MakeDirs (const string &path) |
| Create all the parent directories for path; like mkdir -p `basename path`. | |
| virtual string | ReadFile (const string &path, string *err)=0 |
| Read a file to a string. Fill in |err| on error. | |
| virtual int | RemoveFile (const string &path)=0 |
| Remove the file named path. | |
| virtual TimeStamp | Stat (const string &path)=0 |
| stat() a file, returning the mtime, or 0 if missing and -1 on other errors. | |
| virtual bool | WriteFile (const string &path, const string &contents)=0 |
| Create a file, with the specified name and contents Returns true on success, false on failure. | |
| virtual | ~DiskInterface () |
Interface for accessing the disk.
Abstract so it can be mocked out for tests. The real implementation is RealDiskInterface.
Definition at line 27 of file disk_interface.h.
| virtual DiskInterface::~DiskInterface | ( | ) | [inline, virtual] |
Definition at line 28 of file disk_interface.h.
| virtual bool DiskInterface::MakeDir | ( | const string & | path | ) | [pure virtual] |
Create a directory, returning false on failure.
Implemented in VirtualFileSystem, and RealDiskInterface.
Referenced by MakeDirs().
| bool DiskInterface::MakeDirs | ( | const string & | path | ) |
Create all the parent directories for path; like mkdir -p `basename path`.
Definition at line 59 of file disk_interface.cc.
References MakeDir(), and Stat().
Referenced by Builder::StartEdge().
| virtual string DiskInterface::ReadFile | ( | const string & | path, |
| string * | err | ||
| ) | [pure virtual] |
Read a file to a string. Fill in |err| on error.
Implemented in VirtualFileSystem, and RealDiskInterface.
Referenced by Builder::ExtractDeps(), and ImplicitDepLoader::LoadDepFile().
| virtual int DiskInterface::RemoveFile | ( | const string & | path | ) | [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().
| virtual TimeStamp DiskInterface::Stat | ( | const string & | path | ) | [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(), MakeDirs(), and Node::Stat().
| virtual bool DiskInterface::WriteFile | ( | const string & | path, |
| const string & | contents | ||
| ) | [pure virtual] |
Create a file, with the specified name and contents Returns true on success, false on failure.
Implemented in VirtualFileSystem, and RealDiskInterface.
Referenced by Builder::StartEdge().
1.7.6.1