| 683 | } |
| 684 | |
| 685 | std::string Path::AppendDirectory(const std::string_view path, const std::string_view new_dir) |
| 686 | { |
| 687 | std::string ret; |
| 688 | if (!new_dir.empty()) |
| 689 | { |
| 690 | const std::string_view::size_type pos = GetLastSeperatorPosition(path, true); |
| 691 | |
| 692 | ret.reserve(path.length() + new_dir.length() + 1); |
| 693 | if (pos != std::string_view::npos) |
| 694 | PathAppendString(ret, path.substr(0, pos)); |
| 695 | |
| 696 | while (!ret.empty() && ret.back() == FS_OSPATH_SEPARATOR_CHARACTER) |
| 697 | ret.pop_back(); |
| 698 | |
| 699 | if (!ret.empty()) |
| 700 | ret += FS_OSPATH_SEPARATOR_CHARACTER; |
| 701 | |
| 702 | PathAppendString(ret, new_dir); |
| 703 | |
| 704 | if (pos != std::string_view::npos) |
| 705 | { |
| 706 | const std::string_view filepart(path.substr(pos)); |
| 707 | if (!filepart.empty()) |
| 708 | { |
| 709 | ret += FS_OSPATH_SEPARATOR_CHARACTER; |
| 710 | PathAppendString(ret, filepart); |
| 711 | } |
| 712 | } |
| 713 | else if (!path.empty()) |
| 714 | { |
| 715 | ret += FS_OSPATH_SEPARATOR_CHARACTER; |
| 716 | PathAppendString(ret, path); |
| 717 | } |
| 718 | } |
| 719 | else |
| 720 | { |
| 721 | PathAppendString(ret, path); |
| 722 | } |
| 723 | |
| 724 | return ret; |
| 725 | } |
| 726 | |
| 727 | void Path::AppendDirectory(std::string* path, const std::string_view new_dir) |
| 728 | { |
nothing calls this directly
no test coverage detected