要把zipEntry的反斜線取代成斜線之後打開就不會報錯了,可以參考https://stackoverflow.com/a/58844652/3926429
var zipEntry = ZipEntry(pp.relativize(path).toString().replace("\\","/"))
epubcheck還是有一些錯誤(翻譯有點問題,改成英文版):
$ LANG=C epubcheck Documents/Demo2.epub
Validating using EPUB version 2.0.1 rules.
ERROR(PKG-006): Documents/Demo2.epub(-1,-1): Mimetype file entry is missing or is not the first file in the archive.
ERROR(PKG-007): Documents/Demo2.epub/mimetype(-1,-1): Mimetype file should only contain the string "application/epub+zip" and should not be compressed.
ERROR(RSC-005): Documents/Demo2.epub/OEBPS/content.opf(11,15): Error while parsing file: element "language" not allowed anywhere; expected element "dc:contributor", "dc:coverage", "dc:creator", "dc:date", "dc:description", "dc:format", "dc:identifier", "dc:language", "dc:publisher", "dc:relation", "dc:rights", "dc:source", "dc:subject", "dc:title", "dc:type" or "meta" or an element from another namespace
ERROR(RSC-005): Documents/Demo2.epub/OEBPS/content.opf(17,14): Error while parsing file: element "metadata" incomplete; missing required element "dc:language"
ERROR(RSC-005): Documents/Demo2.epub/OEBPS/toc.ncx(34,45): Error while parsing file: different playOrder values for navPoint/navTarget/pageTarget that refer to same target
ERROR(RSC-005): Documents/Demo2.epub/OEBPS/toc.ncx(39,47): Error while parsing file: different playOrder values for navPoint/navTarget/pageTarget that refer to same target