Archives processing routine. More...
#include <utilities/zip_utilities.h>
Static Public Member Functions | |
static void | ExtractFiles (const std::string &ArchivePath, const std::string &DirectoryPath) |
static void | ArchiveDirectory (const std::string &ArchivePath, const std::string &DirectoryPath) |
Archives processing routine.
Definition at line 45 of file zip_utilities.h.
void nitro::ZIPUtilities::ArchiveDirectory | ( | const std::string & | ArchivePath, | |
const std::string & | DirectoryPath | |||
) | [static] |
Function adds all files from the specified directory to the archive.
ArchivePath | - Path to the archive. | |
DirectoryPath | - Path to the source directory. |
nitro::exception | Throws exception with error description. |
Definition at line 37 of file zip_utilities.cpp.
References nitro::ZIPAbstraction::AddFile(), nitro::ZIPAbstraction::Close(), nitro::exception::code(), nitro::CollectFilesFromDirectory(), and nitro::exception::what().
{ try { nitro::ZIPAbstraction ZipFile( ArchivePath ); std::vector< std::string > Paths; nitro::CollectFilesFromDirectory( DirectoryPath , Paths ); for( std::size_t i( 0 ) ; i < Paths.size() ; i++ ) { ZipFile.AddFile( Paths[ i ] ); } ZipFile.Close(); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "ZIPUtilities::ArchiveDirectory( const std::string & ArchivePath , const std::string & DirectoryPath )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "ZIPUtilities::ArchiveDirectory( const std::string & ArchivePath , const std::string & DirectoryPath )::An error occured" ) , 1 ) ); } }
void nitro::ZIPUtilities::ExtractFiles | ( | const std::string & | ArchivePath, | |
const std::string & | DirectoryPath | |||
) | [static] |
Function extracts files into directory.
ArchivePath | - Path to the extracting archive. | |
DirectoryPath | - Path to the destination directory. |
nitro::exception | Throws exception with error description. |
Definition at line 13 of file zip_utilities.cpp.
References nitro::UnZIPAbstraction::Close(), nitro::exception::code(), nitro::UnZIPAbstraction::GetCountOfFiles(), nitro::UnZIPAbstraction::UnZIPFile(), and nitro::exception::what().
{ try { nitro::UnZIPAbstraction ZipFile( ArchivePath ); std::size_t FileCount( ZipFile.GetCountOfFiles() ); for( std::size_t i( 0 ) ; i < FileCount ; i++ ) { ZipFile.UnZIPFile( i , DirectoryPath , false ); } ZipFile.Close(); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "ZIPUtilities::ExtractFiles( const std::string & ArchivePath , const std::string & DirectoryPath )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "ZIPUtilities::ExtractFiles( const std::string & ArchivePath , const std::string & DirectoryPath )::An error occured" ) , 1 ) ); } }