[fpc-pascal] [RFC] Modification to packages/paszlib/src/zipper.pp

Michael Van Canneyt michael at freepascal.org
Sun Sep 28 11:38:52 CEST 2008

On Sun, 28 Sep 2008, Brad Campbell wrote:

> With reference to this thread..
> http://www.nabble.com/FPC-Zip-library-td15145102.html
> and the resulting bug entry..
> http://bugs.freepascal.org/view.php?id=10787
> I had a similar requirement, so I went and had a crack at patching zipper.pas.
> It does precisely what _I_ want it to do, but it's not the cleanest of hacks
> and I wonder if there is a better way to do it?

The proper way is to create a new collection item

  TZipFileEntry = Class(TcollectionItem)
    ArchiveFileName : String;
    DiskFileName : String;
    FStream : TStream;
  TZipFileEntries = Class(TCollection)

And add an overloaded call

  ZipFiles(AFileName : String; Files : TZipFileEntries);

Which calculates ArchiveFileName from DiskFileName if ArchiveFileName is empty,
and which uses FStream if it is set instead of DiskFileName;

This can then be used to solve both the name inside the zip file as well
as allowing it to work with streams (another request). The current call 
should then simply rework the stringlist to a TZipFileEntries collection, 
and call the overloaded version.

I'll have a stab at it this afternoon. Shouldn't be long to do.


More information about the fpc-pascal mailing list