Lines Matching refs:path
34 namespace android::incremental::path { namespace
47 static void preparePathComponent(std::string_view& path, bool trimAll) { in preparePathComponent() argument
49 while (!path.empty() && path.front() == '/' && in preparePathComponent()
50 (trimAll || (path.size() > 1 && path[1] == '/'))) { in preparePathComponent()
51 path.remove_prefix(1); in preparePathComponent()
54 while (path.size() > !trimAll && path.back() == '/') { in preparePathComponent()
55 path.remove_suffix(1); in preparePathComponent()
59 void details::append_next_path(std::string& target, std::string_view path) { in append_next_path() argument
60 preparePathComponent(path, !target.empty()); in append_next_path()
61 if (path.empty()) { in append_next_path()
67 target += path; in append_next_path()
87 bool isAbsolute(std::string_view path) { in isAbsolute() argument
88 return !path.empty() && path[0] == '/'; in isAbsolute()
91 std::string normalize(std::string_view path) { in normalize() argument
92 if (path.empty()) { in normalize()
95 if (path.starts_with("../"sv)) { in normalize()
100 if (isAbsolute(path)) { in normalize()
101 path.remove_prefix(1); in normalize()
112 for (; end != path.npos; start = end + 1) { in normalize()
113 end = path.find('/', start); in normalize()
115 auto part = path.substr(start, end - start); in normalize()
138 std::string_view basename(std::string_view path) { in basename() argument
139 if (path.empty()) { in basename()
142 if (path == "/"sv) { in basename()
145 auto pos = path.rfind('/'); in basename()
146 while (!path.empty() && pos == path.size() - 1) { in basename()
147 path.remove_suffix(1); in basename()
148 pos = path.rfind('/'); in basename()
150 if (pos == path.npos) { in basename()
151 return path.empty() ? "/"sv : path; in basename()
153 return path.substr(pos + 1); in basename()
156 std::string_view dirname(std::string_view path) { in dirname() argument
157 if (path.empty()) { in dirname()
160 if (path == "/"sv) { in dirname()
163 const auto pos = path.rfind('/'); in dirname()
167 if (pos == path.npos) { in dirname()
170 return path.substr(0, pos); in dirname()
203 bool startsWith(std::string_view path, std::string_view prefix) { in startsWith() argument
204 if (!base::StartsWith(path, prefix)) { in startsWith()
207 return path.size() == prefix.size() || path[prefix.size()] == '/'; in startsWith()