Browse Source

cmGeneratedFileStream: Use absolute paths

Use absolute paths in cmGeneratedFileStream to ensure output can be found
if the working directory changes.

Fixes: #23784
Martin Duffy 3 years ago
parent
commit
b02ef99fea
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Source/cmGeneratedFileStream.cxx

+ 3 - 3
Source/cmGeneratedFileStream.cxx

@@ -124,10 +124,10 @@ cmGeneratedFileStreamBase::~cmGeneratedFileStreamBase()
 void cmGeneratedFileStreamBase::Open(std::string const& name)
 {
   // Save the original name of the file.
-  this->Name = name;
+  this->Name = cmSystemTools::CollapseFullPath(name);
 
   // Create the name of the temporary file.
-  this->TempName = name;
+  this->TempName = this->Name;
 #if defined(__VMS)
   this->TempName += "_";
 #else
@@ -231,7 +231,7 @@ int cmGeneratedFileStreamBase::RenameFile(std::string const& oldname,
 
 void cmGeneratedFileStream::SetName(const std::string& fname)
 {
-  this->Name = fname;
+  this->Name = cmSystemTools::CollapseFullPath(fname);
 }
 
 void cmGeneratedFileStream::SetTempExt(std::string const& ext)