Sign in Join
Wiki copytemporary

Revision 1 of 2, by Alextpp on 3-22-2021. The page as it is now.

FreePascalArchivePackage

About

This is a conversion of TurboPower Software's Abbrevia library for the Free Pascal Compiler. Abbrevia is a compression toolkit that supports PKZIP 4, Microsoft CAB, TAR, & gzip formats. The package contains visual components that simplify the manipulation of ZIP files.

Status: Alpha, ie it needs testing.

This package was created and generously made available to the open source community by TurboPower Software.

License: MPL 1.1.

Download

The latest release of FpArchive can be found on the Lazarus CCR Files page.

Outdated: Getting the latest source from CVS. Only svn ("Subversion") is being used by now. CVS is no longer being used.

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/lazarus-ccr login

(press the Enter key when prompted for a password)

cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/lazarus-ccr co fparchive

This package is also available from the Free Pascal Compiler CVS in projects/contrib/abbrevia

Dependencies

Small amounts of 386 assembler.

Usage

1. For your project open "Project->Compiler Options->Other unit files" and add the path to the FPArchive units

2. In the "uses" clause of your unit add AbBase, AbBrowse, AbZBrows, AbUnzper, AbArcTyp

3. Create an unzip object:

pascal
UnZip := TAbUnZipper.Create(nil);

4. Set the directory where you want to extract the files to:

pascal
UnZip.BaseDirectory := '/path/to/extract';

5. To restore directories structure (optional) add this line:

pascal
UnZip.ExtractOptions := [eoCreateDirs, eoRestorePath];

6. Try to extract all CSV files (for example) from an archive file:

pascal
try
  UnZip.FileName := '/file/to/extract.zip';
  UnZip.ExtractFiles('*.csv');
except
  on E: Exception do
  begin
    //some error handling
  end;
end;

7. Free the created object:

pascal
UnZip.Free;

See also


From the Free Pascal wiki, page "FreePascalArchivePackage", as it stood on 2021-03-22 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.