On Thu, 14 Jul 2016, Bo Berglund wrote:
On Thu, 14 Jul 2016 13:32:38 +0200 (CEST), Michael Van Canneyt
<[email protected]> 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?
Because you can add a file with a different filename to the zip.
e.g. an absolute filename with a relative filename.
Or add a case sensitive filename for the filesystem with an all-lowercase
filename.
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?
With the call above. The first name is the 'real' filename. The second name
is the filename that will be stored in the zip.
(or was it vice versa ?)
Michael.
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal