ENH: Add a way to overwrite compression extension

This commit is contained in:
Andy Cedilnik 2006-01-02 07:52:54 -05:00
parent f379128fa3
commit b7ba65ed68
2 changed files with 19 additions and 3 deletions

View File

@ -107,13 +107,20 @@ void cmGeneratedFileStream::SetCompression(bool compression)
m_Compress = compression;
}
//----------------------------------------------------------------------------
void cmGeneratedFileStream::SetCompressionExtraExtension(bool ext)
{
m_CompressExtraExtension = ext;
}
//----------------------------------------------------------------------------
cmGeneratedFileStreamBase::cmGeneratedFileStreamBase():
m_Name(),
m_TempName(),
m_CopyIfDifferent(false),
m_Okay(false),
m_Compress(false)
m_Compress(false),
m_CompressExtraExtension(true)
{
}
@ -123,7 +130,8 @@ cmGeneratedFileStreamBase::cmGeneratedFileStreamBase(const char* name):
m_TempName(),
m_CopyIfDifferent(false),
m_Okay(false),
m_Compress(false)
m_Compress(false),
m_CompressExtraExtension(true)
{
this->Open(name);
}
@ -155,7 +163,7 @@ void cmGeneratedFileStreamBase::Open(const char* name)
void cmGeneratedFileStreamBase::Close()
{
std::string resname = m_Name;
if ( m_Compress )
if ( m_CompressExtraExtension )
{
resname += ".gz";
}

View File

@ -66,6 +66,9 @@ protected:
// Whether the destionation file is compressed
bool m_Compress;
// Whether the destionation file is compressed
bool m_CompressExtraExtension;
};
/** \class cmGeneratedFileStream
@ -131,6 +134,11 @@ public:
*/
void SetCompression(bool compression);
/**
* Set whether compression has extra extension
*/
void SetCompressionExtraExtension(bool ext);
/**
* Set name of the file that will hold the actual output. This method allows
* the output file to be changed during the use of cmGeneratedFileStream.