PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Extracting the path of a file found in the archive
zipExtractPath (Example)
Extracting the path of a file found in the archive
WINDEVUser code (UMC)
The following code is used to display the path of a file in an archive. The file whose path is extracted is selected in a memory table (TABLE_ArchiveTable). The stored path of the files contains: the name of the directories, the name and extension of the file. ZipExtractPath returns the name and extension of the file.
// Declare and initialize the variables
DirectoryName is string
ArchiveName is string = "MyArchive"
ErrorCodeCreation is int
ErrorCodeAddition is int
ExtractedPath is string
FileSubscript is int
 
// Create an archive
ErrorCodeCreation = zipCreate(ArchiveName, ...
"C:\Directory\Archives\PDFArchive.wdz")
IF ErrorCodeCreation = 0 THEN
// Select the directory
DirectoryName = fSelectDir("", "", "Directory to add")
// Add all the files found in the selected directory
// and in its subdirectories into the archive
ErrorCodeAddition = zipAddDirectory(ArchiveName, DirectoryName, ...
True, zipDirectory)
IF ErrorCodeAddition = 0 THEN
    // Select the file in the archive
    FileSubscript = TableSelect(TABLE_ArchiveTable)
    // Extract the selected file
    ExtractedPath = zipExtractPath(ArchiveName, FileSubscript, ...
zipFilename + zipExtension)
    // Display the extracted path
IF ExtractedPath <> "" THEN
Info("The name and extension of the file are: " + ...
ExtractedPath)
END
ELSE
    // Display the error message
// if the files have not been added
    Error(zipMsgError(ErrorCodeAddition))
END
ELSE
// Display an error message if the archive was not created
Error(zipMsgError(ErrorCodeCreation))
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment