80. Compressing and decompressing files to/from a ZIP archive

To solve this two-part problem, we will use the same ZipLib library we saw for the solution of the previous problem. The solution to this problem consists of two functions, one that is able to perform the compression to a ZIP archive and one that is able to perform decompression from a ZIP archive.

In order to perform the requested compression, we should do the following:

  • If the source path represents a regular file, then add that file to the ZIP archive using ZipFile::AddFile()
  • If the source path represents a recursive directory, then:
    • Iterate recursively through all the entries in the directory
    • If an entry is a directory, then create a directory entry in the ZIP archive with ...

Get The Modern C++ Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.