Утилиты для работы с архивами. Подробнее...
#include <utilities/zip_utilities.h>
Открытые статические члены | |
| static void | ExtractFiles (const std::string &ArchivePath, const std::string &DirectoryPath) |
| static void | ArchiveDirectory (const std::string &ArchivePath, const std::string &DirectoryPath) |
Утилиты для работы с архивами.
См. определение в файле zip_utilities.h строка 45
| void nitro::ZIPUtilities::ArchiveDirectory | ( | const std::string & | ArchivePath, | |
| const std::string & | DirectoryPath | |||
| ) | [static] |
Функция архивации директории.
| ArchivePath | - Путь к архиву. | |
| DirectoryPath | - Путь к архивируемой папке. |
| nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле zip_utilities.cpp строка 37
Перекрестные ссылки nitro::ZIPAbstraction::AddFile(), nitro::ZIPAbstraction::Close(), nitro::exception::code(), nitro::CollectFilesFromDirectory() и 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] |
Функция распаковки файла в директорию.
| ArchivePath | - Путь к архиву. | |
| DirectoryPath | - Путь к папке, в которую осуществляется распаковка. |
| nitro::exception | Кидает исключение с описанием ошибки. |
См. определение в файле zip_utilities.cpp строка 13
Перекрестные ссылки nitro::UnZIPAbstraction::Close(), nitro::exception::code(), nitro::UnZIPAbstraction::GetCountOfFiles(), nitro::UnZIPAbstraction::UnZIPFile() и 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 ) );
}
}

1.6.1