aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/outputs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/outputs')
-rw-r--r--src/sisudoc/outputs/io_out/source_pod.d38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/sisudoc/outputs/io_out/source_pod.d b/src/sisudoc/outputs/io_out/source_pod.d
index b929e06..bfbad70 100644
--- a/src/sisudoc/outputs/io_out/source_pod.d
+++ b/src/sisudoc/outputs/io_out/source_pod.d
@@ -547,8 +547,46 @@ template spinePod() {
}
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