summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratedFileStream.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-07 17:26:14 (GMT)
committerBrad King <brad.king@kitware.com>2020-07-08 19:49:56 (GMT)
commit0d3a034725bdf221f7ea47eee286854facac4979 (patch)
tree2620845276b83d3e3dc8c491789fd3fc5ccb625a /Source/cmGeneratedFileStream.cxx
parent26c12711598cd7b1eadaf8261773255599e10a29 (diff)
downloadCMake-0d3a034725bdf221f7ea47eee286854facac4979.zip
CMake-0d3a034725bdf221f7ea47eee286854facac4979.tar.gz
CMake-0d3a034725bdf221f7ea47eee286854facac4979.tar.bz2
cmGeneratedFileStream: Optionally use custom temporary file extension
Diffstat (limited to 'Source/cmGeneratedFileStream.cxx')
-rw-r--r--Source/cmGeneratedFileStream.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 9cee0e6..119067e 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -122,10 +122,15 @@ void cmGeneratedFileStreamBase::Open(std::string const& name)
// Create the name of the temporary file.
this->TempName = name;
#if defined(__VMS)
- this->TempName += "_tmp";
+ this->TempName += "_";
#else
- this->TempName += ".tmp";
+ this->TempName += ".";
#endif
+ if (!this->TempExt.empty()) {
+ this->TempName += this->TempExt;
+ } else {
+ this->TempName += "tmp";
+ }
// Make sure the temporary file that will be used is not present.
cmSystemTools::RemoveFile(this->TempName);
@@ -216,3 +221,8 @@ void cmGeneratedFileStream::SetName(const std::string& fname)
{
this->Name = fname;
}
+
+void cmGeneratedFileStream::SetTempExt(std::string const& ext)
+{
+ this->TempExt = ext;
+}