| 651 | } |
| 652 | |
| 653 | std::string Path::ChangeFileName(const std::string_view path, const std::string_view new_filename) |
| 654 | { |
| 655 | std::string ret; |
| 656 | PathAppendString(ret, path); |
| 657 | |
| 658 | const std::string_view::size_type pos = GetLastSeperatorPosition(ret, true); |
| 659 | if (pos == std::string_view::npos) |
| 660 | { |
| 661 | ret.clear(); |
| 662 | PathAppendString(ret, new_filename); |
| 663 | } |
| 664 | else |
| 665 | { |
| 666 | if (!new_filename.empty()) |
| 667 | { |
| 668 | ret.erase(pos); |
| 669 | PathAppendString(ret, new_filename); |
| 670 | } |
| 671 | else |
| 672 | { |
| 673 | ret.erase(pos - 1); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | return ret; |
| 678 | } |
| 679 | |
| 680 | void Path::ChangeFileName(std::string* path, const std::string_view new_filename) |
| 681 | { |
nothing calls this directly
no test coverage detected