| 778 | } |
| 779 | |
| 780 | BOOST_FILESYSTEM_DECL path_algorithms::string_type::size_type path_algorithms::find_parent_path_size(path const& p) |
| 781 | { |
| 782 | const size_type size = p.m_pathname.size(); |
| 783 | size_type root_name_size = 0; |
| 784 | size_type root_dir_pos = find_root_directory_start(p.m_pathname.c_str(), size, root_name_size); |
| 785 | |
| 786 | size_type filename_size = find_filename_size(p.m_pathname, root_name_size, size); |
| 787 | size_type end_pos = size - filename_size; |
| 788 | while (true) |
| 789 | { |
| 790 | if (end_pos <= root_name_size) |
| 791 | { |
| 792 | // Keep the root name as the parent path if there was a filename |
| 793 | if (filename_size == 0) |
| 794 | end_pos = 0u; |
| 795 | break; |
| 796 | } |
| 797 | |
| 798 | --end_pos; |
| 799 | |
| 800 | if (!detail::is_directory_separator(p.m_pathname[end_pos])) |
| 801 | { |
| 802 | ++end_pos; |
| 803 | break; |
| 804 | } |
| 805 | |
| 806 | if (end_pos == root_dir_pos) |
| 807 | { |
| 808 | // Keep the trailing root directory if there was a filename |
| 809 | end_pos += filename_size > 0; |
| 810 | break; |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | return end_pos; |
| 815 | } |
| 816 | |
| 817 | BOOST_FILESYSTEM_DECL path path_algorithms::filename_v3(path const& p) |
| 818 | { |
nothing calls this directly
no test coverage detected