Lines Matching refs:path
56 std::wstring path; in mkstemp() local
57 CHECK(android::base::UTF8ToWide(name_template, &path)) in mkstemp()
59 if (_wmktemp_s(path.data(), path.size() + 1) != 0) { in mkstemp()
65 int fd = _wopen(path.c_str(), O_CREAT | O_EXCL | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR); in mkstemp()
71 CHECK(android::base::WideToUTF8(path, &path_utf8)) << "path can't be converted to utf8"; in mkstemp()
79 std::wstring path; in mkdtemp() local
80 CHECK(android::base::UTF8ToWide(name_template, &path)) in mkdtemp()
83 if (_wmktemp_s(path.data(), path.size() + 1) != 0) { in mkdtemp()
87 if (_wmkdir(path.c_str()) != 0) { in mkdtemp()
92 CHECK(android::base::WideToUTF8(path, &path_utf8)) << "path can't be converted to utf8"; in mkdtemp()
148 unlink(path); in ~TemporaryFile()
159 snprintf(path, sizeof(path), "%s%cTemporaryFile-XXXXXX", tmp_dir.c_str(), OS_PATH_SEPARATOR); in init()
161 fd = mkstemp(path, sizeof(path)); in init()
163 fd = mkstemp(path); in init()
199 nftw(path, callback, 128, FTW_DEPTH | FTW_MOUNT | FTW_PHYS); in ~TemporaryDir()
203 snprintf(path, sizeof(path), "%s%cTemporaryDir-XXXXXX", tmp_dir.c_str(), OS_PATH_SEPARATOR); in init()
205 return (mkdtemp(path, sizeof(path)) != nullptr); in init()
207 return (mkdtemp(path) != nullptr); in init()
236 bool ReadFileToString(const std::string& path, std::string* content, bool follow_symlinks) { in ReadFileToString() argument
240 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags))); in ReadFileToString()
261 static bool CleanUpAfterFailedWrite(const std::string& path) { in CleanUpAfterFailedWrite() argument
264 unlink(path.c_str()); in CleanUpAfterFailedWrite()
270 bool WriteStringToFile(const std::string& content, const std::string& path, in WriteStringToFile() argument
275 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags, mode))); in WriteStringToFile()
285 return CleanUpAfterFailedWrite(path); in WriteStringToFile()
289 return CleanUpAfterFailedWrite(path); in WriteStringToFile()
293 return CleanUpAfterFailedWrite(path); in WriteStringToFile()
299 bool WriteStringToFile(const std::string& content, const std::string& path, in WriteStringToFile() argument
303 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags, 0666))); in WriteStringToFile()
307 return WriteStringToFd(content, fd) || CleanUpAfterFailedWrite(path); in WriteStringToFile()
365 bool RemoveFileIfExists(const std::string& path, std::string* err) { in RemoveFileIfExists() argument
369 int result = stat(path.c_str(), &st); in RemoveFileIfExists()
372 int result = lstat(path.c_str(), &st); in RemoveFileIfExists()
388 if (unlink(path.c_str()) == -1) { in RemoveFileIfExists()
399 bool Readlink(const std::string& path, std::string* result) { in Readlink() argument
408 ssize_t size = readlink(path.c_str(), &buf[0], buf.size()); in Readlink()
423 bool Realpath(const std::string& path, std::string* result) { in Realpath() argument
429 realpath_buf = realpath(path.c_str(), nullptr); in Realpath()
443 std::string path; in GetExecutablePath() local
444 android::base::Readlink("/proc/self/exe", &path); in GetExecutablePath()
445 return path; in GetExecutablePath()
447 char path[PATH_MAX + 1]; in GetExecutablePath()
448 uint32_t path_len = sizeof(path); in GetExecutablePath()
449 int rc = _NSGetExecutablePath(path, &path_len); in GetExecutablePath()
455 return path; in GetExecutablePath()
457 char path[PATH_MAX + 1]; in GetExecutablePath()
458 DWORD result = GetModuleFileName(NULL, path, sizeof(path) - 1); in GetExecutablePath()
459 if (result == 0 || result == sizeof(path) - 1) return ""; in GetExecutablePath()
460 path[PATH_MAX - 1] = 0; in GetExecutablePath()
461 return path; in GetExecutablePath()
471 std::string Basename(const std::string& path) { in Basename() argument
473 std::string result(path); in Basename()
496 std::string Dirname(const std::string& path) { in Dirname() argument
498 std::string result(path); in Dirname()