From b7ba65ed684a663be0085ae96dca3768ebdd3325 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Mon, 2 Jan 2006 07:52:54 -0500 Subject: ENH: Add a way to overwrite compression extension --- Source/cmGeneratedFileStream.cxx | 14 +++++++++++--- Source/cmGeneratedFileStream.h | 8 ++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index d0f2cc0..63a0384 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -108,12 +108,19 @@ void cmGeneratedFileStream::SetCompression(bool 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"; } diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index cb81d1d..6d0637c 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -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 @@ -132,6 +135,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. */ -- cgit v0.12