Lines Matching refs:path
34 namespace android::incremental::path { namespace
47 static void preparePathComponent(std::string_view& path, bool trimFront) { in preparePathComponent() argument
49 while (!path.empty() && path.front() == '/') { in preparePathComponent()
50 path.remove_prefix(1); in preparePathComponent()
53 while (!path.empty() && path.back() == '/') { in preparePathComponent()
54 path.remove_suffix(1); in preparePathComponent()
58 void details::append_next_path(std::string& target, std::string_view path) { in append_next_path() argument
59 preparePathComponent(path, true); in append_next_path()
60 if (path.empty()) { in append_next_path()
66 target += path; in append_next_path()
86 bool isAbsolute(std::string_view path) { in isAbsolute() argument
87 return !path.empty() && path[0] == '/'; in isAbsolute()
90 std::string normalize(std::string_view path) { in normalize() argument
91 if (path.empty()) { in normalize()
94 if (path.starts_with("../"sv)) { in normalize()
99 if (isAbsolute(path)) { in normalize()
100 path.remove_prefix(1); in normalize()
111 for (; end != path.npos; start = end + 1) { in normalize()
112 end = path.find('/', start); in normalize()
114 auto part = path.substr(start, end - start); in normalize()
137 std::string_view basename(std::string_view path) { in basename() argument
138 if (path.empty()) { in basename()
141 if (path == "/"sv) { in basename()
144 auto pos = path.rfind('/'); in basename()
145 while (!path.empty() && pos == path.size() - 1) { in basename()
146 path.remove_suffix(1); in basename()
147 pos = path.rfind('/'); in basename()
149 if (pos == path.npos) { in basename()
150 return path.empty() ? "/"sv : path; in basename()
152 return path.substr(pos + 1); in basename()
155 std::string_view dirname(std::string_view path) { in dirname() argument
156 if (path.empty()) { in dirname()
159 if (path == "/"sv) { in dirname()
162 const auto pos = path.rfind('/'); in dirname()
166 if (pos == path.npos) { in dirname()
169 return path.substr(0, pos); in dirname()
200 bool startsWith(std::string_view path, std::string_view prefix) { in startsWith() argument
201 if (!base::StartsWith(path, prefix)) { in startsWith()
204 return path.size() == prefix.size() || path[prefix.size()] == '/'; in startsWith()