#include <ZIP_Wrapper.h>
Static Public Member Functions | |
static bool | get_file (char *archive_path, char *filename, ACE_Message_Block &file) |
static bool | uncompress (char *zip_archive, char *path=0, bool verbose=true) |
static int | file_list_info (char *zip_name, ACE_Double_Linked_List< ZIP_File_Info > &list) |
Get a list of the files in the archive. | |
static int | checkdir (char *filename_inzip) |
filename_inzip is an entry in a zipfile | |
static int | makethedir (char *filename_inzip, ACE_CString arch_dir) |
Create directory structure if entry in zipfile is a directory. | |
static int | handlethefile (char *filename_inzip, unzFile uf, unz_file_info file_info, bool verbose, ACE_CString arch_dir) |
bool ZIP_Wrapper::get_file | ( | char * | archive_path, | |
char * | filename, | |||
ACE_Message_Block & | file | |||
) | [static] |
Get file and store it into an ACE_Message_Block. The function averts subdirectory traversal problems. NOTE: Be sure to release the message block even if the function returns false becuase the return value might be due to unsuccessful allocation archive_path is the zip archive with the path filename is the name of the file to be looked for in the zip archive. the file is stored in ACE message block.
bool ZIP_Wrapper::uncompress | ( | char * | zip_archive, | |
char * | path = 0 , |
|||
bool | verbose = true | |||
) | [static] |
uncompress the zip file The zip file will be uncompressed into a directory with the name of zip archive. The path is assumed to be an existing directory zip_archive is the arcive to be uncompressed with full path. path is used for creating a directory with the name of zip archive.
uncompress the zip file The zip file will be uncompressed into a directory with the name of zip archive. the path is assumed to be an existing directory
int ZIP_Wrapper::file_list_info | ( | char * | zip_name, | |
ACE_Double_Linked_List< ZIP_File_Info > & | list | |||
) | [static] |
Get a list of the files in the archive.
Gets a list of the files in the archive.
zip_name is the name of zipfile with fullpath. list stores information about each entry in zip file.
int ZIP_Wrapper::checkdir | ( | char * | filename_inzip | ) | [static] |
filename_inzip is an entry in a zipfile
try to find if it is a directory OR file
Check if an entry of a zip file is a file or directory We assume a directoryname terminates with a forward slash Returns 1 for directory while 0 for file.
int ZIP_Wrapper::makethedir | ( | char * | filename_inzip, | |
ACE_CString | arch_dir | |||
) | [static] |
Create directory structure if entry in zipfile is a directory.
filename_inzip is an entry in a zipfile arch_dir stores the name of the directory to be created
int ZIP_Wrapper::handlethefile | ( | char * | filename_inzip, | |
unzFile | uf, | |||
unz_file_info | file_info, | |||
bool | verbose, | |||
ACE_CString | arch_dir | |||
) | [static] |
If entry in zipfile is a file, then read the file and write the uncompressed data at the proper filepath. filename_inzip is an entry in a zipfile uf refers to the zip archive file_info is used to get information about current file verbose decides if the details are to be printed or not arch_dir is the name of file with full path where it is to be uncompressed
If entry in zipfile is a file, then read the file and write the uncompressed data at the proper filepath.