MCPcopy Create free account
hub / github.com/NativeScript/android / shorten_path

Function shorten_path

test-app/runtime/src/main/cpp/ada/ada.cpp:11217–11238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11215}
11216
11217ada_really_inline bool shorten_path(std::string& path,
11218 ada::scheme::type type) noexcept {
11219 // Let path be url's path.
11220 // If url's scheme is "file", path's size is 1, and path[0] is a normalized
11221 // Windows drive letter, then return.
11222 if (type == ada::scheme::type::FILE &&
11223 path.find('/', 1) == std::string_view::npos && !path.empty()) {
11224 if (checkers::is_normalized_windows_drive_letter(
11225 helpers::substring(path, 1))) {
11226 return false;
11227 }
11228 }
11229
11230 // Remove path's last item, if any.
11231 size_t last_delimiter = path.rfind('/');
11232 if (last_delimiter != std::string::npos) {
11233 path.erase(last_delimiter);
11234 return true;
11235 }
11236
11237 return false;
11238}
11239
11240ada_really_inline bool shorten_path(std::string_view& path,
11241 ada::scheme::type type) noexcept {

Callers 3

parse_prepared_pathFunction · 0.85
parse_url_implFunction · 0.85
consume_prepared_pathMethod · 0.85

Calls 5

eraseMethod · 0.80
findMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected