Difference between revisions of "FreePascalArchivePackage"

From Lazarus wiki
Jump to navigationJump to search
(code highlighting and category)
Line 33: Line 33:
  
 
=== Usage ===
 
=== Usage ===
1. For your project open "Project->Compiler Options->Other unit files" and add the path to the FPArchive units;<br />
+
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;<br />
+
 
3. Create an unzip object: UnZip := TAbUnZipper.Create(nil);<br />
+
2. In the "uses" clause of your unit add AbBase, AbBrowse, AbZBrows, AbUnzper
4. Set the directory where you want to extrat the files to: UnZip.BaseDirectory := '/path/to/extract';<br />
+
 
5. Try to extract all CSV files (for example) from an arhive file:  
+
3. Create an unzip object: <delphi>UnZip := TAbUnZipper.Create(nil);</delphi>
  try
+
 
    UnZip.FileName := '/file/to/extract.zip';
+
4. Set the directory where you want to extract the files to:  
    UnZip.ExtractFiles('*.csv');
+
<delphi>UnZip.BaseDirectory := '/path/to/extract';</delphi>
  except
+
 
    on E: Exception do
+
5. Try to extract all CSV files (for example) from an archive file:  
    begin
+
<delphi>try
      //some error handling
+
  UnZip.FileName := '/file/to/extract.zip';
    end;
+
  UnZip.ExtractFiles('*.csv');
 +
except
 +
  on E: Exception do
 +
  begin
 +
    //some error handling
 
   end;
 
   end;
6. Free the created object: UnZip.Free;
+
end;</delphi>
 +
6. Free the created object: <delphi>UnZip.Free;</delphi>
 +
 
 +
[[Category:Components]]

Revision as of 08:22, 14 January 2011

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

Needs testing.

Author

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.

Change Log

Version 3.05

- Changed the unit name "types" to "typesarchive" to avoid conflict with Lazarus' unit "types";
- added {$mode delphi} in abfcifdi.pas for compatability.

Getting the latest source from CVS

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 / System Requirements

Small amounts of 386 assembler.

Installation

Un-tar the file

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

3. Create an unzip object: <delphi>UnZip := TAbUnZipper.Create(nil);</delphi>

4. Set the directory where you want to extract the files to: <delphi>UnZip.BaseDirectory := '/path/to/extract';</delphi>

5. Try to extract all CSV files (for example) from an archive file: <delphi>try

 UnZip.FileName := '/file/to/extract.zip';
 UnZip.ExtractFiles('*.csv');

except

 on E: Exception do
 begin
   //some error handling
 end;

end;</delphi> 6. Free the created object: <delphi>UnZip.Free;</delphi>