Unit CastleZip

Description

ZIP files handling (TCastleZip).

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class EZipNotOpen  
Class TCastleZip A collection of files inside a ZIP archive.

Functions and Procedures

procedure ZipDirectory(const ZipUrl: String; DirectoryUrl: String; const SingleTopLevelDirectory: Boolean = true);

Description

Functions and Procedures

procedure ZipDirectory(const ZipUrl: String; DirectoryUrl: String; const SingleTopLevelDirectory: Boolean = true);

Create a .zip file named ZipUrl containing all files (recursively) in the DirectoryUrl.

As usual in our engine, both parameters should be URLs. Although we also make reasonable effort to handle filenames when given.

Directory may but doesn't have to end with trailing /. The directory URL must, right now, resolve to a local directory (file URL), we cannot package other URL types.

SingleTopLevelDirectory meaning:

  • When SingleTopLevelDirectory = True:

    The directory is added to the zip file as a top-level directory inside zip. E.g. if directory is 'file:///home/michalis/mydir', then the zip file will contain as top level 'mydir'. There shall be no trace of '/home/michalis/' in the resulting zp file.

  • When SingleTopLevelDirectory = False:

    Then only contents of the directory are inside the zip, and so it can have multiple top-level entries.

We gracefully handle the case when ZIP file (ZipUrl) is inside the directory, by not packing the ZIP in this case in itself (and making a warning), to avoid possible reading and writing the file at the same time.


Generated by PasDoc 0.16.0-snapshot.