mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
cmSystemTools: use an enumeration for compression formats
Juggling 3 booleans was unwieldy.
This commit is contained in:
@@ -1482,7 +1482,7 @@ bool cmSystemTools::IsPathToFramework(const char* path)
|
||||
|
||||
bool cmSystemTools::CreateTar(const char* outFileName,
|
||||
const std::vector<std::string>& files,
|
||||
bool gzip, bool bzip2, bool xz,
|
||||
cmTarCompression compressType,
|
||||
bool verbose)
|
||||
{
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
@@ -1497,11 +1497,24 @@ bool cmSystemTools::CreateTar(const char* outFileName,
|
||||
cmSystemTools::Error(e.c_str());
|
||||
return false;
|
||||
}
|
||||
cmArchiveWrite a(fout, (gzip? cmArchiveWrite::CompressGZip :
|
||||
(bzip2? cmArchiveWrite::CompressBZip2 :
|
||||
(xz? cmArchiveWrite::CompressXZ :
|
||||
cmArchiveWrite::CompressNone))),
|
||||
cmArchiveWrite::TypeTAR);
|
||||
cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone;
|
||||
switch (compressType)
|
||||
{
|
||||
case TarCompressGZip:
|
||||
compress = cmArchiveWrite::CompressGZip;
|
||||
break;
|
||||
case TarCompressBZip2:
|
||||
compress = cmArchiveWrite::CompressBZip2;
|
||||
break;
|
||||
case TarCompressXZ:
|
||||
compress = cmArchiveWrite::CompressXZ;
|
||||
break;
|
||||
case TarCompressNone:
|
||||
compress = cmArchiveWrite::CompressNone;
|
||||
break;
|
||||
}
|
||||
cmArchiveWrite a(fout, compress,
|
||||
cmArchiveWrite::TypeTAR);
|
||||
a.SetVerbose(verbose);
|
||||
for(std::vector<std::string>::const_iterator i = files.begin();
|
||||
i != files.end(); ++i)
|
||||
@@ -1526,7 +1539,6 @@ bool cmSystemTools::CreateTar(const char* outFileName,
|
||||
#else
|
||||
(void)outFileName;
|
||||
(void)files;
|
||||
(void)gzip;
|
||||
(void)verbose;
|
||||
return false;
|
||||
#endif
|
||||
@@ -1787,7 +1799,7 @@ bool extract_tar(const char* outFileName, bool verbose,
|
||||
#endif
|
||||
|
||||
bool cmSystemTools::ExtractTar(const char* outFileName,
|
||||
bool , bool verbose)
|
||||
bool verbose)
|
||||
{
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
return extract_tar(outFileName, verbose, true);
|
||||
@@ -1799,7 +1811,6 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
|
||||
}
|
||||
|
||||
bool cmSystemTools::ListTar(const char* outFileName,
|
||||
bool ,
|
||||
bool verbose)
|
||||
{
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
|
||||
Reference in New Issue
Block a user