[Cmake-commits] [cmake-commits] alex committed cmCTestScriptHandler.h 1.21 1.22 cmCTestScriptHandler.cxx 1.49 1.50
cmake-commits at cmake.org
cmake-commits at cmake.org
Sat Jul 11 16:30:20 EDT 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv3391
Modified Files:
cmCTestScriptHandler.h cmCTestScriptHandler.cxx
Log Message:
STYLE: move the code for writing the initial cache into its own separate
function, makes the long ProcessHandler() a little bit shorter
Alex
Index: cmCTestScriptHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestScriptHandler.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C 2 -d -r1.21 -r1.22
*** cmCTestScriptHandler.h 11 Jul 2009 20:27:28 -0000 1.21
--- cmCTestScriptHandler.h 11 Jul 2009 20:30:18 -0000 1.22
***************
*** 92,95 ****
--- 92,100 ----
/*
+ * Write an initial CMakeCache.txt from the given contents.
+ */
+ static bool WriteInitialCache(const char* directory, const char* text);
+
+ /*
* Some elapsed time handling functions
*/
Index: cmCTestScriptHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestScriptHandler.cxx,v
retrieving revision 1.49
retrieving revision 1.50
diff -C 2 -d -r1.49 -r1.50
*** cmCTestScriptHandler.cxx 11 Jul 2009 20:27:28 -0000 1.49
--- cmCTestScriptHandler.cxx 11 Jul 2009 20:30:18 -0000 1.50
***************
*** 882,901 ****
if (!this->InitialCache.empty())
{
! std::string cacheFile = this->BinaryDir;
! cacheFile += "/CMakeCache.txt";
! cmGeneratedFileStream fout(cacheFile.c_str());
! if(!fout)
{
this->RestoreBackupDirectories();
return 9;
}
-
- fout.write(this->InitialCache.c_str(), this->InitialCache.size());
-
- // Make sure the operating system has finished writing the file
- // before closing it. This will ensure the file is finished before
- // the check below.
- fout.flush();
- fout.close();
}
--- 882,891 ----
if (!this->InitialCache.empty())
{
! if (!this->WriteInitialCache(this->BinaryDir.c_str(),
! this->InitialCache.c_str()))
{
this->RestoreBackupDirectories();
return 9;
}
}
***************
*** 996,999 ****
--- 986,1013 ----
}
+ //-------------------------------------------------------------------------
+ bool cmCTestScriptHandler::WriteInitialCache(const char* directory,
+ const char* text)
+ {
+ std::string cacheFile = directory;
+ cacheFile += "/CMakeCache.txt";
+ cmGeneratedFileStream fout(cacheFile.c_str());
+ if(!fout)
+ {
+ return false;
+ }
+
+ if (text!=0)
+ {
+ fout.write(text, strlen(text));
+ }
+
+ // Make sure the operating system has finished writing the file
+ // before closing it. This will ensure the file is finished before
+ // the check below.
+ fout.flush();
+ fout.close();
+ return true;
+ }
//-------------------------------------------------------------------------
More information about the Cmake-commits
mailing list