From 0952a96485cad05f68724f0a703758dceb60add9 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Thu, 21 Sep 2006 15:09:34 -0400 Subject: ENH: Handle zip (command line was too long) --- Source/CPack/cmCPackZIPGenerator.cxx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 578fa0a..eeedaee 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -91,20 +91,22 @@ int cmCPackZIPGenerator::CompressFiles(const char* outFileName, const char* toplevel, const std::vector& files) { std::string tempFileName; + tempFileName = toplevel; + tempFileName += "/winZip.filelist"; + bool needQuotesInFile = false; cmOStringStream dmgCmd; switch ( this->ZipStyle ) { case cmCPackZIPGenerator::StyleWinZip: - tempFileName = toplevel; - tempFileName += "/winZip.filelist"; dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") << "\" -P \"" << outFileName << "\" @\"" << tempFileName.c_str() << "\""; + needQuotesInFile = true; break; case cmCPackZIPGenerator::StyleUnixZip: dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") - << "\" \"" << outFileName - << "\""; + << "\" -r \"" << outFileName + << "\" . -i@winZip.filelist"; break; default: cmCPackLogger(cmCPackLog::LOG_ERROR, "Unknown ZIP style" @@ -117,9 +119,16 @@ int cmCPackZIPGenerator::CompressFiles(const char* outFileName, std::vector::const_iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) { - out << "\"" - << cmSystemTools::RelativePath(toplevel, fileIt->c_str()) - << "\"" << std::endl; + if ( needQuotesInFile ) + { + out << "\""; + } + out << cmSystemTools::RelativePath(toplevel, fileIt->c_str()); + if ( needQuotesInFile ) + { + out << "\""; + } + out << std::endl; } } else -- cgit v0.12