[fpc-pascal] Using paszlib from fpc 3.0 with fpc and delphi 2007?

Bo Berglund bo.berglund at gmail.com
Fri Jul 8 12:05:37 CEST 2016


On Thu, 26 May 2016 12:43:05 +0200, Bo Berglund
<bo.berglund at gmail.com> wrote:

>I got a suggestion from the Embarcadero
>forum to check Synopse and there I found a single file (plus an inc)
>solution to my problem.
>I downloaded the PasZip.pas and Synopse.inc files from this location:
>http://synopse.info/fossil/dir?ci=tip

>This is the function I ended up with and it works just fine:
>
>
>function TSSCommHandler.ZipFiles(TargetFile: string; FileList:
>TStringList): boolean;
>{This function uses the Synopse files PasZip.pas and Synopse.inc to
>create the zipfile.
>Files were obtained from http://synopse.info/fossil/dir?ci=tip}
>var
>  ZW: TZipWrite;
>  i: integer;
>  FileName: string;
>begin
>  Result := false;
>  ZW := TZipWrite.Create(TargetFile);
>  try
>    try
>      for i := 0 to FileList.Count-1 do
>      begin
>        FileName := FileList[i];
>        if not FileExists(FileName) then Continue;
>        ZW.AddDeflated(FileName);
>      end;
>      Result := true;
>    except
>      on E: Exception do
>      begin
>        FLastError := 'Zip error: ' + E.Message;
>        exit;
>      end;
>    end;
>  finally
>    ZW.Free;
>  end;
>end;
>
>I am only interested in the creation of the zipfile, but there is a
>reader class available too.

I have a question on regards to this PasZip unit:

In the function above the supplied files wind up in the zip archive as
intended, but I would like to improve it just a little bit by also
setting the extract dir to the name of the zipfile.
So if the zip is named PP1.zip I want the contents to be extracted to
subdir PP1 in the dir where the zip is located.

Is there anyone here who has used PasZip.pas from Synopse and have a
solution?

-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list