| 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 | { |