减小打包体积

This commit is contained in:
2026-09-06 00:24:19 +08:00
parent 85c4fcde41
commit cc99b7b596
4 changed files with 48 additions and 2 deletions
+14 -2
View File
@@ -81,8 +81,20 @@ std::string form_value(const std::string& body, const std::string& key) {
}
std::string sanitize_process_error(std::string output) {
output = std::regex_replace(output, std::regex(R"(^Licensed to:.*$)", std::regex::icase | std::regex::multiline), "Spine 授权信息已隐藏");
return trim(output);
// 逐行替换,避免依赖 std::regex::multilineMSVC 的 <regex> 未实现该标志)。
const std::regex licensed(R"(^Licensed to:.*$)", std::regex::icase);
std::string result;
std::size_t start = 0;
while (start <= output.size()) {
const auto end = output.find('\n', start);
std::string line = output.substr(start, end - start);
if (!line.empty() && line.back() == '\r') line.pop_back();
result += std::regex_replace(line, licensed, "Spine 授权信息已隐藏");
if (end == std::string::npos) break;
result += '\n';
start = end + 1;
}
return trim(result);
}
std::pair<std::vector<std::uint8_t>, std::string> convert(const Json& payload, const std::string& executable) {