Lines Matching refs:path

32 namespace android::incfs::path {  namespace
66 bool isAbsolute(std::string_view path) { in isAbsolute() argument
67 return !path.empty() && path[0] == '/'; in isAbsolute()
70 std::string normalize(std::string_view path) { in normalize() argument
71 if (path.empty()) { in normalize()
74 if (path.starts_with("../"sv)) { in normalize()
79 if (isAbsolute(path)) { in normalize()
80 path.remove_prefix(1); in normalize()
91 for (; end != path.npos; start = end + 1) { in normalize()
92 end = path.find('/', start); in normalize()
94 auto part = path.substr(start, end - start); in normalize()
132 std::string readlink(std::string_view path) { in readlink() argument
135 auto cPath = c_str(path); in readlink()
145 PLOG(ERROR) << "readlink failed for " << path; in readlink()
161 static void preparePathComponent(std::string_view& path, bool trimAll) { in preparePathComponent() argument
163 while (!path.empty() && path.front() == '/' && in preparePathComponent()
164 (trimAll || (path.size() > 1 && path[1] == '/'))) { in preparePathComponent()
165 path.remove_prefix(1); in preparePathComponent()
168 while (path.size() > !trimAll && path.back() == '/') { in preparePathComponent()
169 path.remove_suffix(1); in preparePathComponent()
190 void details::appendNextPath(std::string& res, std::string_view path) { in appendNextPath() argument
191 preparePathComponent(path, !res.empty()); in appendNextPath()
192 if (path.empty()) { in appendNextPath()
198 res += path; in appendNextPath()
225 bool startsWith(std::string_view path, std::string_view prefix) { in startsWith() argument
226 if (!path.starts_with(prefix)) { in startsWith()
229 return path.size() == prefix.size() || path[prefix.size()] == '/'; in startsWith()
232 bool endsWith(std::string_view path, std::string_view suffix) { in endsWith() argument
233 if (!path.ends_with(suffix)) { in endsWith()
236 return path.size() == suffix.size() || path[path.size() - suffix.size() - 1] == '/'; in endsWith()