Re-factor OS X content generator start up.

This commit is contained in:
Nicolas Despres 2012-07-16 23:03:40 +02:00 committed by Peter Kümmel
parent f8e0a5109f
commit c3988ee871
4 changed files with 24 additions and 24 deletions

View File

@ -367,18 +367,8 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
return; return;
} }
// Construct the full path to the content subdirectory. std::string macdir =
std::string macdir = this->Generator->MacContentDirectory; this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(pkgloc);
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);
}
// Get the input file location. // Get the input file location.
std::string input = source.GetFullPath(); std::string input = source.GetFullPath();

View File

@ -664,19 +664,8 @@ cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
return; return;
} }
// Construct the full path to the content subdirectory.
std::string macdir = std::string macdir =
this->Generator->OSXBundleGenerator->GetMacContentDirectory(); this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(pkgloc);
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);
}
// Get the input file location. // Get the input file location.
std::string input = source.GetFullPath(); std::string input = source.GetFullPath();

View File

@ -214,3 +214,23 @@ GenerateMacOSXContentStatements(std::vector<cmSourceFile*> 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;
}

View File

@ -44,6 +44,7 @@ public:
void GenerateMacOSXContentStatements( void GenerateMacOSXContentStatements(
std::vector<cmSourceFile*> const& sources, std::vector<cmSourceFile*> const& sources,
MacOSXContentGeneratorType* generator); MacOSXContentGeneratorType* generator);
std::string InitMacOSXContentDirectory(const char* pkgloc);
std::string GetMacContentDirectory() const std::string GetMacContentDirectory() const
{ return this->MacContentDirectory; } { return this->MacContentDirectory; }