0

I'm creating EPUB files from an application, using ZipOutputStream. When I look at the resulting zip file with Winzip, it seems to be OK, except that in addition to the files and folders I expect, there is an additional folder which should not be there and does not appear in the log output by the code.

My folder structure to be zipped is the same as the IBM Developerworks "Getting Started with EPUB" tutorial. Before I started all this, I created an epub according to the tutorial instructions using WinZip and it extracts correctly, and works correctly in Adobe Digital Editions 2.0.

c:
  /myepub
    /epub
      mimetype
      /META-INF
        container.xml
      /OEBPS
        content.html
        content.opf
        stylesheet.css
        title.html
        toc.ncx
        /images
          cover.png

My Java class (194 lines) creates the zip using the relative part of each name, and the result contains everything that the WinZip-created version has, i.e. it looks like the structure above below the /epub folder.

My code log:

mimetype
META-INF/container.xml
OEBPS/content.html
OEBPS/content.opf
OEBPS/images/cover.png
OEBPS/stylesheet.css
OEBPS/title.html
OEBPS/toc.ncx

But in addition there is:

/myepub
  /epub
    /OEBPS
      images

Note that images here is not a folder, it is a zero-length file.

When I try to extract this with WinZip, it fails with:

Extracting to "C:\myepub\extract\"
Use Path: yes   Overlay Files: no
Extracting OEBPS
C:\myepub\extract\OEBPS exists but is not directory
     unable to process C:\myepub\extract\OEBPS\images.

I must be missing something very fundamental here. Can anyone point me in the right direction?

casgage
  • 529
  • 1
  • 7
  • 18
  • 2
    You're going to need to show us the code where you are creating the entries. In the meantime, what debugging have you done? – MadConan Nov 08 '13 at 13:01
  • Well, I thought I had done enough debugging, but evidently not. I took your advice and after going through it line by line for the 20th time I realized I had been thinking it was necessary to put in the directories explicitly, and removed that and now it works correctly and I can read it with ADE. Thanks. – casgage Nov 09 '13 at 18:35

0 Answers0