ERR: Added automatic creation of directory for cable_config.xml file and corresponding error reporting.

This commit is contained in:
Brad King 2001-03-09 10:52:43 -05:00
parent 93a17629b6
commit 60507258c7
2 changed files with 13 additions and 2 deletions

View File

@ -64,11 +64,18 @@ void cmCableCommand::SetupCableData()
if(m_CableData) if(m_CableData)
{ return; } { return; }
} }
// We must make sure the output directory exists so that the CABLE
// configuration file can be opened by the cmCableData.
std::string pathName = m_Makefile->GetStartOutputDirectory();
if(!cmSystemTools::MakeDirectory(pathName.c_str()))
{
cmSystemTools::Error("Unable to make directory ", pathName.c_str());
}
// We didn't find another cmCableCommand with a valid cmCableData. // We didn't find another cmCableCommand with a valid cmCableData.
// We must allocate the new cmCableData ourselves, and with this // We must allocate the new cmCableData ourselves, and with this
// command as its owner. // command as its owner.
std::string pathName = m_Makefile->GetStartOutputDirectory();
pathName += "/cable_config.xml"; pathName += "/cable_config.xml";
m_CableData = new cmCableData(this, pathName); m_CableData = new cmCableData(this, pathName);
} }

View File

@ -59,6 +59,10 @@ void cmCableData::OpenOutputFile(const std::string& name)
{ {
this->WriteConfigurationHeader(); this->WriteConfigurationHeader();
} }
else
{
cmSystemTools::Error("Unable to open CABLE config file: ", name.c_str());
}
} }