| 192 | void write_artifact_output( |
| 193 | const std::filesystem::path & path, |
| 194 | const engine::runtime::VoiceArtifact & artifact) { |
| 195 | if (!path.parent_path().empty()) { |
| 196 | std::filesystem::create_directories(path.parent_path()); |
| 197 | } |
| 198 | const auto tmp = path.parent_path() / (path.filename().string() + ".tmp"); |
| 199 | std::filesystem::remove(tmp); |
| 200 | std::ofstream output(tmp, std::ios::binary); |
| 201 | if (!output) { |
| 202 | throw std::runtime_error("failed to open artifact output: " + tmp.string()); |
| 203 | } |
| 204 | output.write( |
| 205 | reinterpret_cast<const char *>(artifact.payload.data()), |
no test coverage detected