From c3988ee871c99e31ad4d10e9033d89da902d5694 Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Mon, 16 Jul 2012 23:03:40 +0200 Subject: Re-factor OS X content generator start up. --- Source/cmMakefileTargetGenerator.cxx | 14 ++------------ Source/cmNinjaTargetGenerator.cxx | 13 +------------ Source/cmOSXBundleGenerator.cxx | 20 ++++++++++++++++++++ Source/cmOSXBundleGenerator.h | 1 + 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 342fa49..bc016dc 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -367,18 +367,8 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() return; } - // Construct the full path to the content subdirectory. - std::string macdir = this->Generator->MacContentDirectory; - macdir += pkgloc; - cmSystemTools::MakeDirectory(macdir.c_str()); - - // Record use of this content location. Only the first level - // directory is needed. - { - std::string loc = pkgloc; - loc = loc.substr(0, loc.find('/')); - this->Generator->MacContentFolders.insert(loc); - } + std::string macdir = + this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(pkgloc); // Get the input file location. std::string input = source.GetFullPath(); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 2c7bffc..36eb64d 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -664,19 +664,8 @@ cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( return; } - // Construct the full path to the content subdirectory. std::string macdir = - this->Generator->OSXBundleGenerator->GetMacContentDirectory(); - macdir += pkgloc; - cmSystemTools::MakeDirectory(macdir.c_str()); - - // Record use of this content location. Only the first level - // directory is needed. - { - std::string loc = pkgloc; - loc = loc.substr(0, loc.find('/')); - this->Generator->MacContentFolders.insert(loc); - } + this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(pkgloc); // Get the input file location. std::string input = source.GetFullPath(); diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index c5a8d5f..7d8df59 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -214,3 +214,23 @@ GenerateMacOSXContentStatements(std::vector const& sources, } } } + +//---------------------------------------------------------------------------- +std::string +cmOSXBundleGenerator::InitMacOSXContentDirectory(const char* pkgloc) +{ + // Construct the full path to the content subdirectory. + std::string macdir = this->MacContentDirectory; + macdir += pkgloc; + cmSystemTools::MakeDirectory(macdir.c_str()); + + // Record use of this content location. Only the first level + // directory is needed. + { + std::string loc = pkgloc; + loc = loc.substr(0, loc.find('/')); + this->MacContentFolders->insert(loc); + } + + return macdir; +} diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index c13ca36..2ed9e91 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -44,6 +44,7 @@ public: void GenerateMacOSXContentStatements( std::vector const& sources, MacOSXContentGeneratorType* generator); + std::string InitMacOSXContentDirectory(const char* pkgloc); std::string GetMacContentDirectory() const { return this->MacContentDirectory; } -- cgit v0.12