[fpc-pascal] Porting code from Windows D2007, missing Windows functions

Bo Berglund bo.berglund at gmail.com
Thu Jul 14 14:31:59 CEST 2016


On Thu, 14 Jul 2016 13:32:38 +0200 (CEST), Michael Van Canneyt
<michael at freepascal.org> wrote:


>> Do you have an example of how to do the above with FPC ZLib?
>
>You can find this almost verbatim in the examples of paszlib, using the
>zipper unit.
>

The one I found is this (a command line utility):

uses
  Zipper;
var
  OurZipper: TZipper;
  I: Integer;
begin
  OurZipper := TZipper.Create;
  try
    OurZipper.FileName := ParamStr(1);
    for I := 2 to ParamCount do
      OurZipper.Entries.AddFileEntry(ParamStr(I), ParamStr(I));
    OurZipper.ZipAllFiles;
  finally
    OurZipper.Free;
  end;
end.

It seems straightforward for my method to add all the supplied files
in the stringlist the way the example does it.

But this line:
OurZipper.Entries.AddFileEntry(ParamStr(I), ParamStr(I));

seems to add the files to zip into some kind of internal list.
Why does it take the same argument twice?

One issue I had with PasZip is that I have not found a way to enter
the extract (target) dir for the zipped files.
Can I specify a relative target extract path in the TZipper case, for
example relative to the folder where the zipfile being extracted
resides?
If so how?


-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list