Lines Matching refs:path
41 string DirName(const string& path) {
49 string::size_type slash_pos = path.find_last_of(kPathSeparators);
53 std::find(kPathSeparators, kEnd, path[slash_pos - 1]) != kEnd)
55 return path.substr(0, slash_pos);
58 int MakeDir(const string& path) {
60 return _mkdir(path.c_str());
62 return mkdir(path.c_str(), 0777);
77 TimeStamp StatSingleFile(const string& path, string* err) {
79 if (!GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &attrs)) {
83 *err = "GetFileAttributesEx(" + path + "): " + GetLastErrorString();
140 bool DiskInterface::MakeDirs(const string& path) {
141 string dir = DirName(path);
181 TimeStamp RealDiskInterface::Stat(const string& path, string* err) const {
186 if (!path.empty() && !AreLongPathsEnabled() && path[0] != '\\' &&
187 path.size() > MAX_PATH) {
189 err_stream << "Stat(" << path << "): Filename longer than " << MAX_PATH
195 return StatSingleFile(path, err);
197 string dir = DirName(path);
198 string base(path.substr(dir.size() ? dir.size() + 1 : 0));
202 dir = path;
222 if (stat64(path.c_str(), &st) < 0) {
225 if (stat(path.c_str(), &st) < 0) {
229 *err = "stat(" + path + "): " + strerror(errno);
250 bool RealDiskInterface::WriteFile(const string& path, const string& contents) {
251 FILE* fp = fopen(path.c_str(), "w");
254 path.c_str(), strerror(errno));
260 path.c_str(), strerror(errno));
267 path.c_str(), strerror(errno));
274 bool RealDiskInterface::MakeDir(const string& path) {
275 if (::MakeDir(path) < 0) {
279 Error("mkdir(%s): %s", path.c_str(), strerror(errno));
285 FileReader::Status RealDiskInterface::ReadFile(const string& path,
288 switch (::ReadFile(path, contents, err)) {
295 int RealDiskInterface::RemoveFile(const string& path) {
297 DWORD attributes = GetFileAttributesA(path.c_str());
308 SetFileAttributesA(path.c_str(), attributes & ~FILE_ATTRIBUTE_READONLY);
316 if (!RemoveDirectoryA(path.c_str())) {
322 Error("remove(%s): %s", path.c_str(), GetLastErrorString().c_str());
326 if (!DeleteFileA(path.c_str())) {
332 Error("remove(%s): %s", path.c_str(), GetLastErrorString().c_str());
337 if (remove(path.c_str()) < 0) {
342 Error("remove(%s): %s", path.c_str(), strerror(errno));