diff options
author | David Cole <david.cole@kitware.com> | 2009-02-19 15:39:08 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2009-02-19 15:39:08 (GMT) |
commit | 1bf669207b2f3dcc21bd3f3f0b88535a34f4a8aa (patch) | |
tree | 74999fb92cfca79c47e86b988dcd11507465d44c /Source/CPack/cmCPackDragNDropGenerator.cxx | |
parent | 65c1511814ee581fc21ac06eca92145e52215427 (diff) | |
download | CMake-1bf669207b2f3dcc21bd3f3f0b88535a34f4a8aa.zip CMake-1bf669207b2f3dcc21bd3f3f0b88535a34f4a8aa.tar.gz CMake-1bf669207b2f3dcc21bd3f3f0b88535a34f4a8aa.tar.bz2 |
BUG: A little bit more refactoring from BundleGenerator to DragNDropGenerator. See issue #8556. Thanks for Clinton Stimpson for the patch.
Diffstat (limited to 'Source/CPack/cmCPackDragNDropGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.cxx | 100 |
1 files changed, 53 insertions, 47 deletions
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 40ade06..2280662 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -71,6 +71,59 @@ int cmCPackDragNDropGenerator::CompressFiles(const char* outFileName, { (void) files; + return this->CreateDMG(toplevel, outFileName); +} + +//---------------------------------------------------------------------- +bool cmCPackDragNDropGenerator::CopyFile(cmOStringStream& source, + cmOStringStream& target) +{ + if(!cmSystemTools::CopyFileIfDifferent( + source.str().c_str(), + target.str().c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error copying " + << source.str() + << " to " + << target.str() + << std::endl); + + return false; + } + + return true; +} + +//---------------------------------------------------------------------- +bool cmCPackDragNDropGenerator::RunCommand(cmOStringStream& command, + std::string* output) +{ + int exit_code = 1; + + bool result = cmSystemTools::RunSingleCommand( + command.str().c_str(), + output, + &exit_code, + 0, + this->GeneratorVerbose, + 0); + + if(!result || exit_code) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error executing: " + << command.str() + << std::endl); + + return false; + } + + return true; +} + +int cmCPackDragNDropGenerator::CreateDMG(const std::string& toplevel, const std::string& outFileName) +{ // Get optional arguments ... const std::string cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON") ? this->GetOption("CPACK_PACKAGE_ICON") : ""; @@ -204,50 +257,3 @@ int cmCPackDragNDropGenerator::CompressFiles(const char* outFileName, return 1; } -//---------------------------------------------------------------------- -bool cmCPackDragNDropGenerator::CopyFile(cmOStringStream& source, - cmOStringStream& target) -{ - if(!cmSystemTools::CopyFileIfDifferent( - source.str().c_str(), - target.str().c_str())) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error copying " - << source.str() - << " to " - << target.str() - << std::endl); - - return false; - } - - return true; -} - -//---------------------------------------------------------------------- -bool cmCPackDragNDropGenerator::RunCommand(cmOStringStream& command, - std::string* output) -{ - int exit_code = 1; - - bool result = cmSystemTools::RunSingleCommand( - command.str().c_str(), - output, - &exit_code, - 0, - this->GeneratorVerbose, - 0); - - if(!result || exit_code) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error executing: " - << command.str() - << std::endl); - - return false; - } - - return true; -} |