|
- Use condition
- Compression level of ZIP or 7z archives
- Error codes
- Adding a file that is already found in the archive
- Subscript of files in the archive
- Path kept (archives in WDZ or ZIP format)
<zipArchive variable>.AddFile (Function) In french: <Variable zipArchive>.AjouteFichier Syntax
Adding a file while specifying the path section to keep Hide the details
<Result> = <Archive>.AddFile(<File path> [, <Path section to keep> [, <Progress>]])
<Result>: Integer - 0 if the addition was performed,
- an error code (value greater than 0) otherwise. For more details on these error codes, see the remarks.
<Archive>: zipArchive variable Name of a zipArchive variable that corresponds to the archive into which the file will be added. <File path>: Character string (with quotes) Path of the HEX@ to be added to the archive (260 characters maximum, 90 maximum in the case of an archive in TAR or TGZ format (TAR.GZ)). This path can be a full path or a path relative to the current directory. The wildcard characters (*,?) are not allowed in the file name. The size of this file must not exceed 4 GB. Otherwise, an error occurs.
<Path section to keep>: Optional constant Indicates the section of the file path that will be kept in the archive: | | zipNone | Keeps the file name and extension. For example: FileName.pdf | zipDirectory (Default value) | Keeps the different directories of the file path as well as the file name and extension. For example: \Directory\Files\FileName.pdf | zipDrive | Keeps the full and absolute file path (name of disk, name of directories, file name and file extension). For example: C:\Directory\Files\FileName.pdf For the ZIP format: This constant has no effect. For the 7z format: This constant and zipDirectory will have the same effect.
|
If you are using an archive in .CAB format, only the zipNone constant is taken into account. Indeed, the .CAB format cannot be used to save the paths inside the archive.
<Progress>: Control name or procedure name Versions 21 and laterMode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only. New in version 21Mode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only. Mode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only.
Adding a file while specifying the path to ignore Hide the details
<Result> = <Archive>.AddFile(<File path> [, <Path section to ignore> [, <Progress>]])
<Result>: Integer - 0 if the addition was performed,
- an error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
<Archive>: zipArchive variable Name of a zipArchive variable that corresponds to the archive into which the file will be added. <File path>: Character string (with quotes) Path of the HEX@ to be added to the archive (260 characters maximum, 90 maximum in the case of an archive in TAR or TGZ format (TAR.GZ)). This path can be a full path or a path relative to the current directory. The wildcard characters (*,?) are not allowed in the file name. The size of this file must not exceed 4 GB. Otherwise, an error occurs. <Path section to ignore>: Optional character string (with quotes) Indicates the section of file path that must not be stored in the archive. For example, in WINDEV, if the full path of the file added into the archive is: "C:\My Documents\Work\Report.doc" and if <Path section to ignore> is set to "C:\My Documents\", only the "Work\Report.doc" section will be kept. <Progress>: Control name or procedure name Versions 21 and laterMode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only. New in version 21Mode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only. Mode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only.
Adding a file found in a buffer (WDZ and ZIP format only) Hide the details
<Result> = <Archive>.AddFile(<File to add> , <Buffer management> , <Path to keep> [, <Progress>])
<Result>: Integer - 0 if the addition was performed,
- an error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
<Archive>: zipArchive variable Name of a zipArchive variable that corresponds to the archive into which the file will be added. <File to add>: Buffer Buffer that corresponds to the file content that will be added into the archive. <Buffer management>: Constant Mode for managing the buffer: | | zipInMemory | Saves the content of the buffer (i.e. the file) in the archive. |
<Path to keep>: Character string (with quotes) File path or file name associated with the buffer that will be kept in the archive. <Progress>: Control name or procedure name Versions 21 and laterMode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only. New in version 21Mode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only. Mode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only.
Adding a file by using a zipArchivedFile variable Hide the details
<Result> = <Archive>.AddFile(<File> [, <Progress>])
<Result>: Integer - 0 if the addition was performed,
- an error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
<Archive>: zipArchive variable Name of a zipArchive variable that corresponds to the archive into which the file will be added. <File>: zipArchivedFile variable Name of the zipArchivedFile variable that contains information about the file to add (including its content). The file does not necessarily have to exist on the disk: only the information found in this parameter is taken into account. <Progress>: Control name or procedure name Versions 21 and laterMode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only. New in version 21Mode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only. Mode for managing the progress bar. This parameter can correspond to: If you are using an archive in TAR or TGZ (TAR.GZ) format, the progress bar is updated at the end of file addition only.
Compression level of ZIP or 7z archives The files added into an archive in ZIP or 7z format are compressed by default. The compression level of files added into an archive can be modified by zipCompressionLevel. Error codes The following error codes are returned: - 1: The path passed as parameter does not exist.
- 2: Access denied: the user has no sufficient rights or the file is currently used. If the file to insert is a HFSQL data file, it must be closed by the following code:
HClose(FileName) Multitask() // Waits for the effective file closing
- 3: The archive is corrupted.
- 4: The path does not exist in the archive.
- 5: Unable to write into the archive.
- 7: The file is already found in the archive.
- 8: An archive cannot be added to itself. For example, "MyArchive" cannot be added to "MyArchive".
The message corresponding to the error code is returned by zipMsgError. Adding a file that is already found in the archive An error occurs when adding a file that is already found in the archive. A file is identified according to the path saved in the archive. Therefore, two files with the same name and with the same relative path cannot be added into an archive. For example, the zipNone constant cannot be used to add two files with the same name found in different directories. Subscript of files in the archive When a file is added into an archive, a subscript is automatically assigned to the file. This subscript corresponds to the order in which the files are included in the archive. To select a file in the archive, you can use: - the element subscript (remark: the subscript of an element is returned by zipFindFile).
- or the path of the element saved in the archive.
Path kept (archives in WDZ or ZIP format) The array below shows the paths kept in the archive according to: - the access path to the file,
- the path section to keep.
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |