COMP: Fix new cmGeneratedFileStream for MSVC.

This commit is contained in:
Brad King 2004-11-03 07:27:44 -05:00
parent d46d8df0ed
commit e34207c1f0
3 changed files with 6 additions and 7 deletions

View File

@ -31,7 +31,7 @@ cmGeneratedFileStream::cmGeneratedFileStream(const char* name,
bool copy_if_different,
bool quiet):
cmGeneratedFileStreamBase(name, copy_if_different),
std::ofstream(m_TempName.c_str())
Stream(m_TempName.c_str())
{
// Check if the file opened.
if(!*this && !quiet)
@ -49,7 +49,7 @@ cmGeneratedFileStream::~cmGeneratedFileStream()
// stream will be destroyed which will close the temporary file.
// Finally the base destructor will be called to replace the
// destination file.
m_Okay = *this;
m_Okay = (*this)?true:false;
}
//----------------------------------------------------------------------------

View File

@ -61,6 +61,8 @@ class cmGeneratedFileStream: private cmGeneratedFileStreamBase,
public std::ofstream
{
public:
typedef std::ofstream Stream;
/**
* The constructor takes the name of the file to be generated. It
* automatically generates a name for the temporary file. The

View File

@ -289,15 +289,12 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile(cmLocalGenerator* root,
fname += "/";
fname += root->GetMakefile()->GetProjectName();
fname += ".sln";
cmGeneratedFileStream fout(fname.c_str());
cmGeneratedFileStream fout(fname.c_str(), true);
if(!fout)
{
cmSystemTools::Error("Error can not open DSW file for write: ",
fname.c_str());
cmSystemTools::ReportLastSystemError("");
return;
}
this->WriteSLNFile(fout.GetStream(), root, generators);
this->WriteSLNFile(fout, root, generators);
}
// output the SLN file