e-CryptIt Engine - Compression Xojo Plugin

ZipArchiveReader.ExtractDirectoryFromEntryIndex Method

Extracts directory from a given index in the ZipArchive

ExtractDirectoryFromEntryIndex(
   index as UInt32,
   destination as FolderItem)

Parameters

index
The index of the entry in the zip archive. First entry is number zero.The index of the entry in the zip archive. First entry is number zero.
destination
The destination where to extract to.

Remarks

The LastError property can give hint on success or what error was generated.

ExtractDirectoryFromEntryIndex is a high level method that just uses internally the lower level functions of this plugin. If wanting to customise the ExtractDirectoryFromEntryIndex then our implementation for ExtractDirectoryFromEntryIndex is equal to this code here:

Sub ExtractDirectoryFromEntryIndex(zip as EinhugurZipArchives.ZipArchiveReader,index as UInt32, destination as FolderItem)
    Dim f as FolderItem
    Dim part as String
    Dim pathParts() as String
    Dim path as String
   
    f = destination
   
    path = zip.EntryName(index)
    pathParts = path.Split("/")
   
    for i as integer = 0 to pathParts.Ubound()
       part = pathParts(i)
      
       if i = 0 and part = "__MACOSX" then
          return
       end if
      
       if part.Len > 0 then
         
         
          f = f.Child(part)
         
          if not f.Exists then
             f.CreateAsFolder()
          end if
       end if
    next
End Sub

See Also

ZipArchiveReader Class