View Single Post
Old 01-02-2010, 12:29 AM   #8
acts_as_david
Reader/Developer
acts_as_david began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Dec 2009
Device: Sony PRS-600
Quote:
Originally Posted by Kolenka View Post
There is only one ZIP spec, but there are a lot of similar-sounding compression schemes that aren't ZIP (bzip, gzip which don't have an internal file structure, for example, and tend to need you to use the tar format underneath to archive/compress a folder).

One of the other problems you are looking at is that the mimetype needs to be stored rather than compressed in the ZIP archive as the first file. Not all zip libraries even support setting compression for individual files (versus the whole archive).

compress doesn't create ZIP archives, which is a key distinction as well.
Okay, thanks for the details, Kolenka. You're right that the mimetype file was being compressed when it shouldn't have been, giving me a bad epub file. Thomas Sondergaard, the developer of rubyzip, was kind enough to add compression options to his library, which now does what I want.

Quote:
Take a look at ZipArchive. It has both a commercial license and an open source one (GPL).

It's used in Sigil, and I recommend it highly. Works perfectly across Windows, Linux, Mac OS X and the various BSD's.

If your app will be GPL-compatible, feel free to take a look at the patched ZipArchive used in Sigil: it fixes a few bugs related to python generated ZIP files and improves BSD support.
Thanks for the suggestion, Valloric, I'll look into ZipArchive and how it's used in Sigil. I'm sure I can get some good ideas from looking at the code.
acts_as_david is offline   Reply With Quote