[delphizip] RE : New format - internal directory structure

  • From: "James Turner" <james.d.h.turner@xxxxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Wed, 6 Nov 2002 12:01:58 -0000

In the Zip format, both the file headers and directory records contain the 
whole path. This makes the notional movement of files from one directory to 
another rather tricky since it means rewriting the whole archive.

Suppose, the central directory contained an indexed list of paths 
(directories). A non-zero value for this index in a directory record would 
indicate which directory the file currently belonged to. Of course, each path 
entry would have to consist of three fields being
  ParentIndex : Word32; { index of parent directory }
  Length : Word16;
  Name : variable length char string;

The file header need only contain the original file name. All rename/path 
changes could be stored in the central directory entry exclusively. This means 
that the name located in a central directory entry might be different to that 
stored in the corresponding file header. This is ok but some system of error 
checking would probably be a good idea.

If implemented archives would be smaller (not much) and renaming/moving files 
would involve only the rewriting of the central directory. Of course, a Z++ 
program could optionally rewrite the whole archive as is done with zip 
archives, but it would no longer be necessary. This also means that empty 
directories would no longer need to be represented by zero-length files. 
Further, if all the files were moved out of one directory into another, the 
empty directory could be easily deleted.

This still leaves the thorny issues of adding/deleting files (space recovery 
and fragmentation) but it is potentially a step towards creating a versatile 
archive format.


-- James Turner --
http://www.skaro.net



Other related posts: