| 316 | }; |
| 317 | |
| 318 | FileWriter(const std::filesystem::path &path, FingerprintFlag flag) : path(path) |
| 319 | { |
| 320 | a = archive_write_new(); |
| 321 | int ret = archive_write_set_format_pax_restricted(a); |
| 322 | detail::checkArchiveError(a, ret, path, "set format pax restricted"); |
| 323 | ret = archive_write_open_filename(a, path.string().c_str()); |
| 324 | if (ret != ARCHIVE_OK) |
| 325 | { |
| 326 | const char *err = archive_error_string(a); |
| 327 | std::string errmsg = err ? err : "unknown error"; |
| 328 | archive_write_free(a); |
| 329 | a = nullptr; |
| 330 | throw util::RuntimeError( |
| 331 | path.string(), ErrorCode::FileOpenError, SOURCE_REF, errmsg.c_str()); |
| 332 | } |
| 333 | |
| 334 | if (flag == GenerateFingerprint) |
| 335 | { |
| 336 | WriteFingerprint(); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | ~FileWriter() |
| 341 | { |
nothing calls this directly
no test coverage detected