Lines Matching refs:path
35 bool FileExists(const std::string& path) { in FileExists() argument
37 return stat(path.c_str(), &st) == 0; in FileExists()
40 bool FileHasContent(const std::string& path) { in FileHasContent() argument
41 return FileSize(path) > 0; in FileHasContent()
44 bool DirectoryExists(const std::string& path) { in DirectoryExists() argument
46 if (stat(path.c_str(), &st) == -1) { in DirectoryExists()
55 bool IsDirectoryEmpty(const std::string& path) { in IsDirectoryEmpty() argument
56 auto direc = ::opendir(path.c_str()); in IsDirectoryEmpty()
58 LOG(ERROR) << "IsDirectoryEmpty test failed with " << path in IsDirectoryEmpty()
68 LOG(ERROR) << "IsDirectoryEmpty test failed with " << path in IsDirectoryEmpty()
76 std::string AbsolutePath(const std::string& path) { in AbsolutePath() argument
77 if (path.empty()) { in AbsolutePath()
80 if (path[0] == '/') { in AbsolutePath()
81 return path; in AbsolutePath()
83 if (path[0] == '~') { in AbsolutePath()
84 LOG(WARNING) << "Tilde expansion in path " << path <<" is not supported"; in AbsolutePath()
94 return std::string{buffer.data()} + "/" + path; in AbsolutePath()
97 off_t FileSize(const std::string& path) { in FileSize() argument
99 if (stat(path.c_str(), &st) == -1) { in FileSize()
106 std::chrono::system_clock::time_point FileModificationTime(const std::string& path) { in FileModificationTime() argument
108 if (stat(path.c_str(), &st) == -1) { in FileModificationTime()
143 char* path = getcwd(nullptr, 0); in CurrentDirectory() local
144 std::string ret(path); in CurrentDirectory()
145 free(path); in CurrentDirectory()
149 FileSizes SparseFileSizes(const std::string& path) { in SparseFileSizes() argument
150 auto fd = SharedFD::Open(path, O_RDONLY); in SparseFileSizes()
152 LOG(ERROR) << "Could not open \"" << path << "\": " << fd->StrError(); in SparseFileSizes()
158 LOG(ERROR) << "Could not lseek in \"" << path << "\": " << fd->StrError(); in SparseFileSizes()
170 LOG(ERROR) << "Could not lseek in \"" << path << "\": " << fd->StrError(); in SparseFileSizes()
186 LOG(ERROR) << "Could not lseek in \"" << path << "\": " << fd->StrError(); in SparseFileSizes()