diff options
Diffstat (limited to 'org/out_src_pod.org')
| -rw-r--r-- | org/out_src_pod.org | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/org/out_src_pod.org b/org/out_src_pod.org index 96f784f..7efc52a 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -580,8 +580,46 @@ void podArchive_directory_tree(M,P)(M doc_matters, P pths_pod) { // create direc #+BEGIN_SRC d void zipArchive(M,F,Z)(M doc_matters, F fn_pod, Z zip) { import sisudoc.ocda.zstd : zstdCompress, ZstdException; + import sisudoc.ocda.io_in.carried_names : MAX_POD_ENTRY_COUNT; auto fn_src_in = doc_matters.src.filename; if (doc_matters.opt.action.pod) { + /+ ↓ the writer is held to the number the reader enforces. + Previously it was not: a document with enough parts produced an + archive spine would write and then refused to read, reporting too many + entries, so a good file looked corrupt. The count is a judgement call; + a writer able to emit what the reader rejects is a fault whatever the + number is. + . + An error rather than a warning, because the artefact would be + unreadable: writing it and reporting success is the one outcome worth + ruling out. The message names the count, the limit and the document, so + that "this document has too many parts for one archive" is legible + without a debugger. + +/ + if (zip.directory.length > MAX_POD_ENTRY_COUNT) { + writeln("ERROR >> pod archive not written: ", fn_pod); + writeln(" ", doc_matters.src.filename_base, " would hold ", + zip.directory.length, " members, over the ", MAX_POD_ENTRY_COUNT, + " a pod archive may carry."); + writeln(" a document's members are its languages times its markup", + " and catalogue files; spine would not be able to read back what", + " it wrote."); + /+ ↓ an archive left by an earlier pass is removed. + A missing artefact is an error anyone will notice; a quietly + truncated one is not. + +/ + if (exists(fn_pod)) { + try { + fn_pod.remove; + writeln(" the incomplete archive left by an earlier language", + " has been removed."); + } catch (Exception ex) { + writeln("WARNING could not remove the incomplete archive: ", + fn_pod, " - ", ex.msg); + } + } + return; + } if (exists(doc_matters.src.file_with_absolute_path)) { try { /+ ↓ the archive is built exactly as before and then wrapped in one |
