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()
152 static void preparePathComponent(std::string_view& path, bool trimFront) { in preparePathComponent() argument
154 while (!path.empty() && path.front() == '/') { in preparePathComponent()
155 path.remove_prefix(1); in preparePathComponent()
158 while (!path.empty() && path.back() == '/') { in preparePathComponent()
159 path.remove_suffix(1); in preparePathComponent()
180 void details::appendNextPath(std::string& res, std::string_view path) { in appendNextPath() argument
181 preparePathComponent(path, true); in appendNextPath()
182 if (path.empty()) { in appendNextPath()
188 res += path; in appendNextPath()
191 std::string_view baseName(std::string_view path) { in baseName() argument
192 if (path.empty()) { in baseName()
195 if (path == "/"sv) { in baseName()
198 auto pos = path.rfind('/'); in baseName()
199 while (!path.empty() && pos == path.size() - 1) { in baseName()
200 path.remove_suffix(1); in baseName()
201 pos = path.rfind('/'); in baseName()
203 if (pos == path.npos) { in baseName()
204 return path.empty() ? "/"sv : path; in baseName()
206 return path.substr(pos + 1); in baseName()
209 std::string_view dirName(std::string_view path) { in dirName() argument
210 if (path.empty()) { in dirName()
213 if (path == "/"sv) { in dirName()
216 const auto pos = path.rfind('/'); in dirName()
220 if (pos == path.npos) { in dirName()
223 return path.substr(0, pos); in dirName()
250 bool startsWith(std::string_view path, std::string_view prefix) { in startsWith() argument
251 if (!path.starts_with(prefix)) { in startsWith()
254 return path.size() == prefix.size() || path[prefix.size()] == '/'; in startsWith()
257 bool endsWith(std::string_view path, std::string_view suffix) { in endsWith() argument
258 if (!path.ends_with(suffix)) { in endsWith()
261 return path.size() == suffix.size() || path[path.size() - suffix.size() - 1] == '/'; in endsWith()