MCPcopy Create free account
hub / github.com/arvidn/libtorrent / lsplit_path

Function lsplit_path

src/path.cpp:943–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

941 }
942
943 std::pair<string_view, string_view> lsplit_path(string_view p)
944 {
945 if (p.empty()) return {{}, {}};
946 // for absolute paths, skip the initial "/"
947 if (p.front() == TORRENT_SEPARATOR_CHAR) p.remove_prefix(1);
948#if defined(TORRENT_WINDOWS) || defined(TORRENT_OS2)
949 else if (p.front() == '/') p.remove_prefix(1);
950#endif
951#if defined(TORRENT_WINDOWS) || defined(TORRENT_OS2)
952 auto const sep = p.find_first_of("/\\");
953#else
954 auto const sep = p.find_first_of(TORRENT_SEPARATOR_CHAR);
955#endif
956 if (sep == string_view::npos) return {p, {}};
957 return { p.substr(0, sep), p.substr(sep + 1) };
958 }
959
960 std::pair<string_view, string_view> lsplit_path(string_view p, std::size_t pos)
961 {

Callers 10

TORRENT_TESTFunction · 0.85
add_files_implFunction · 0.85
add_symlink_pathFunction · 0.85
generateMethod · 0.85
update_path_indexMethod · 0.85
add_file_borrowMethod · 0.85
sanitize_symlinksMethod · 0.85
path_compareFunction · 0.85
completeFunction · 0.85

Calls 3

find_first_ofFunction · 0.85
frontMethod · 0.80
emptyMethod · 0.45

Tested by 1

TORRENT_TESTFunction · 0.68