Lines Matching refs:std

80 bool FileExists(const std::string& path, bool follow_symlinks) {  in FileExists()
85 Result<dev_t> FileDeviceId(const std::string& path) { in FileDeviceId()
95 Result<bool> CanHardLink(const std::string& source, in CanHardLink()
96 const std::string& destination) { in CanHardLink()
101 Result<ino_t> FileInodeNumber(const std::string& path) { in FileInodeNumber()
111 Result<bool> AreHardLinked(const std::string& source, in AreHardLinked()
112 const std::string& destination) { in AreHardLinked()
119 Result<std::string> CreateHardLink(const std::string& target, in CreateHardLink()
120 const std::string& hardlink, in CreateHardLink()
145 bool FileHasContent(const std::string& path) { in FileHasContent()
149 Result<std::vector<std::string>> DirectoryContents(const std::string& path) { in DirectoryContents()
150 std::vector<std::string> ret; in DirectoryContents()
151 std::unique_ptr<DIR, int(*)(DIR*)> dir(opendir(path.c_str()), closedir); in DirectoryContents()
160 bool DirectoryExists(const std::string& path, bool follow_symlinks) { in DirectoryExists()
171 Result<void> EnsureDirectoryExists(const std::string& directory_path, in EnsureDirectoryExists()
173 const std::string& group_name) { in EnsureDirectoryExists()
204 Result<void> ChangeGroup(const std::string& path, in ChangeGroup()
205 const std::string& group_name) { in ChangeGroup()
220 bool CanAccess(const std::string& path, const int mode) { in CanAccess()
224 bool IsDirectoryEmpty(const std::string& path) { in IsDirectoryEmpty()
228 << " as it failed to be open" << std::endl; in IsDirectoryEmpty()
238 << " as it exists but not empty" << std::endl; in IsDirectoryEmpty()
245 Result<void> RecursivelyRemoveDirectory(const std::string& path) { in RecursivelyRemoveDirectory()
310 bool Copy(const std::string& from, const std::string& to) { in Copy()
368 std::string AbsolutePath(const std::string& path) { in AbsolutePath()
380 std::array<char, PATH_MAX> buffer{}; in AbsolutePath()
386 return std::string{buffer.data()} + "/" + path; in AbsolutePath()
389 off_t FileSize(const std::string& path) { in FileSize()
397 bool MakeFileExecutable(const std::string& path) { in MakeFileExecutable()
403 std::chrono::system_clock::time_point FileModificationTime(const std::string& path) { in FileModificationTime()
406 return std::chrono::system_clock::time_point(); in FileModificationTime()
409 std::chrono::seconds seconds(st.st_mtim.tv_sec); in FileModificationTime()
411 std::chrono::seconds seconds(st.st_mtimespec.tv_sec); in FileModificationTime()
415 return std::chrono::system_clock::time_point(seconds); in FileModificationTime()
418 Result<std::string> RenameFile(const std::string& current_filepath, in RenameFile()
419 const std::string& target_filepath) { in RenameFile()
428 bool RemoveFile(const std::string& file) { in RemoveFile()
434 << std::strerror(errno); in RemoveFile()
438 std::string ReadFile(const std::string& file) { in ReadFile()
439 std::string contents; in ReadFile()
440 std::ifstream in(file, std::ios::in | std::ios::binary); in ReadFile()
441 in.seekg(0, std::ios::end); in ReadFile()
446 if (in.tellg() == std::ifstream::pos_type(-1)) { in ReadFile()
451 in.seekg(0, std::ios::beg); in ReadFile()
457 Result<std::string> ReadFileContents(const std::string& filepath) { in ReadFileContents()
463 std::string file_content; in ReadFileContents()
470 std::string CurrentDirectory() { in CurrentDirectory()
471 std::unique_ptr<char, void (*)(void*)> cwd(getcwd(nullptr, 0), &free); in CurrentDirectory()
472 std::string process_cwd(cwd.get()); in CurrentDirectory()
480 FileSizes SparseFileSizes(const std::string& path) { in SparseFileSizes()
527 std::string cpp_basename(const std::string& str) { in cpp_basename()
529 std::string ret(basename(copy)); in cpp_basename()
534 std::string cpp_dirname(const std::string& str) { in cpp_dirname()
538 bool FileIsSocket(const std::string& path) { in FileIsSocket()
543 int GetDiskUsage(const std::string& path) { in GetDiskUsage()
554 std::array<char, 1024> text_output{}; in GetDiskUsage()
557 std::move(subprocess).Wait(); in GetDiskUsage()
567 std::string FindImage(const std::string& search_path, in FindImage()
568 const std::vector<std::string>& pattern) { in FindImage()
569 const std::string& search_path_extend = search_path + "/"; in FindImage()
571 std::string image = search_path_extend + name; in FindImage()
579 std::string FindFile(const std::string& path, const std::string& target_name) { in FindFile()
580 std::string ret; in FindFile()
582 [&ret, &target_name](const std::string& filename) mutable { in FindFile()
594 const std::string& dir, in WalkDirectory()
595 const std::function<bool(const std::string&)>& callback) { in WalkDirectory()
614 InotifyWatcher(int inotify, const std::string& path, int watch_mode) in InotifyWatcher()
625 static Result<void> WaitForFileInternal(const std::string& path, int timeoutSec, in WaitForFileInternal()
634 std::chrono::system_clock::now() + std::chrono::seconds(timeoutSec); in WaitForFileInternal()
649 const auto currentTime = std::chrono::system_clock::now(); in WaitForFileInternal()
656 std::chrono::duration_cast<std::chrono::microseconds>(targetTime - in WaitForFileInternal()
660 std::chrono::microseconds(std::chrono::seconds(1)).count(); in WaitForFileInternal()
692 auto WaitForFile(const std::string& path, int timeoutSec) in WaitForFile()
701 Result<void> WaitForUnixSocket(const std::string& path, int timeoutSec) { in WaitForUnixSocket()
703 std::chrono::system_clock::now() + std::chrono::seconds(timeoutSec); in WaitForUnixSocket()
710 const auto currentTime = std::chrono::system_clock::now(); in WaitForUnixSocket()
716 const auto timeRemain = std::chrono::duration_cast<std::chrono::seconds>( in WaitForUnixSocket()
732 Result<void> WaitForUnixSocketListeningWithoutConnect(const std::string& path, in WaitForUnixSocketListeningWithoutConnect()
735 std::chrono::system_clock::now() + std::chrono::seconds(timeoutSec); in WaitForUnixSocketListeningWithoutConnect()
741 std::regex socket_state_regex("TST=(.*)"); in WaitForUnixSocketListeningWithoutConnect()
744 const auto currentTime = std::chrono::system_clock::now(); in WaitForUnixSocketListeningWithoutConnect()
753 std::string lsof_out; in WaitForUnixSocketListeningWithoutConnect()
754 std::string lsof_err; in WaitForUnixSocketListeningWithoutConnect()
756 RunWithManagedStdio(std::move(lsof), nullptr, &lsof_out, &lsof_err); in WaitForUnixSocketListeningWithoutConnect()
764 std::smatch socket_state_match; in WaitForUnixSocketListeningWithoutConnect()
765 if (std::regex_search(lsof_out, socket_state_match, socket_state_regex)) { in WaitForUnixSocketListeningWithoutConnect()
767 const std::string& socket_state = socket_state_match[1]; in WaitForUnixSocketListeningWithoutConnect()
783 std::vector<std::string> FoldPath(std::vector<std::string> elements, in FoldPath()
784 std::string token) { in FoldPath()
785 static constexpr std::array kIgnored = {".", "..", ""}; in FoldPath()
794 Result<std::vector<std::string>> CalculatePrefix( in CalculatePrefix()
797 std::string working_dir; in CalculatePrefix()
803 std::vector<std::string> prefix; in CalculatePrefix()
816 Result<std::string> EmulateAbsolutePath(const InputPathForm& path_info) { in EmulateAbsolutePath()
818 std::string working_dir; in EmulateAbsolutePath()
833 std::vector<std::string> components; in EmulateAbsolutePath()
842 std::string combined = android::base::Join(components, "/"); in EmulateAbsolutePath()
846 auto processed_tokens = std::accumulate(components.begin(), components.end(), in EmulateAbsolutePath()
847 std::vector<std::string>{}, FoldPath); in EmulateAbsolutePath()
851 std::string real_path = processed_path; in EmulateAbsolutePath()