View Single Post
Old 12-11-2010, 10:24 PM   #3
Ankh
Guru
Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.
 
Ankh's Avatar
 
Posts: 714
Karma: 2003751
Join Date: Oct 2008
Location: Ottawa, ON
Device: Kobo Glo HD
Quote:
Originally Posted by DMSmillie View Post
First, add the "mimetype" file to the zip file.

Then add the rest of the contents of the folder, including the sub-folders, to the zip file.

That is not precise enough according to the standard. Although some of the reading platforms might read non-standard epub files.

The rules for the "mimetype" file are defined in Open Container Format, and the text of interest (bold text used for emphasis, my intervention):
Quote:
The first file in the ZIP Container MUST be a file by the ASCII name of ‘mimetype’ which holds the MIME type for the ZIP Container (i.e., “application/epub+zip” as an ASCII string; no padding, white-space or case change). The file MUST be neither compressed nor encrypted and there MUST NOT be an extra field in its ZIP header.
So, using command line zip utility, the proper command to add "mimetype" to the archive, while positioned to the directory/folder containing the file is:
zip -X0 <some other directory>\<name_of_the_target_file>.epub mimetype

Note that archive is created in some other directory, which simplifies the next step, adding the rest of the files to the same archive:
zip -Xur9D <some other directory>\<name_of_the_target_file>.epub *

Last edited by Ankh; 12-12-2010 at 01:43 PM.
Ankh is offline   Reply With Quote