ZZIP Future

back to
index

ZIP-Write

Anybody out there who wants to program the write-support for the zziplib? Actually, I just do not have the time to do it and no real need to but I guess it would be nice for people as for example to spit out savegame files in zipformat. The actual programming path is almost obvious - start off with the zziplib as it is, and let it open an existing zip-file. This will parse the central directory into memory - including the file-offsets for each file. Then, truncate the zip-realfile to the place that the central-dir was found (identical with the end of the last file). If a datafile is opened for writing, either add a new entry or modify the start-offset of the existing entry to the end of the zip-realfile - the old data is simply junk. Then init zlib to do the deflation of the data and append it to the current zip-realfile. When the zipdir-handle is getting closed from write-mode, the zip's central-directory needs to be appended to the file on disk. This coincides with creating a new zip-file with an empty central-directory that can be spit out to disk. During development, do not care about creating temp-files to guard against corruption for partial writes - the usual application will use the zziplib to create zip savegames in one turn, no "update"-operation needs to be implemented like exists in the standalone zip command utilities.


guidod@gmx.de 15. July 2002