| 86 | } |
| 87 | |
| 88 | void SplitFileExtension(const std::string& path, |
| 89 | std::string* root, |
| 90 | std::string* ext) { |
| 91 | const auto parts = StringSplit(path, "."); |
| 92 | THROW_CHECK_GT(parts.size(), 0); |
| 93 | if (parts.size() == 1) { |
| 94 | *root = parts[0]; |
| 95 | *ext = ""; |
| 96 | } else { |
| 97 | *root = ""; |
| 98 | for (size_t i = 0; i < parts.size() - 1; ++i) { |
| 99 | *root += parts[i] + "."; |
| 100 | } |
| 101 | *root = root->substr(0, root->length() - 1); |
| 102 | if (parts.back() == "") { |
| 103 | *ext = ""; |
| 104 | } else { |
| 105 | *ext = "." + parts.back(); |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | void FileCopy(const std::filesystem::path& src_path, |
| 111 | const std::filesystem::path& dst_path, |