diff options
Diffstat (limited to 'Source/cmVTKWrapTclCommand.cxx')
-rw-r--r-- | Source/cmVTKWrapTclCommand.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmVTKWrapTclCommand.cxx b/Source/cmVTKWrapTclCommand.cxx index 995f863..44579d9 100644 --- a/Source/cmVTKWrapTclCommand.cxx +++ b/Source/cmVTKWrapTclCommand.cxx @@ -184,7 +184,8 @@ bool cmVTKWrapTclCommand::WriteInit(const char *kitName, std::vector<std::string>& classes) { unsigned int i; - FILE *fout = fopen(outFileName.c_str(),"w"); + std::string tempOutputFile = outFileName + ".tmp"; + FILE *fout = fopen(tempOutputFile.c_str(),"w"); if (!fout) { return false; @@ -259,6 +260,11 @@ bool cmVTKWrapTclCommand::WriteInit(const char *kitName, fprintf(fout," return TCL_OK;\n}\n"); fclose(fout); + // copy the file if different + cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(), + outFileName.c_str()); + cmSystemTools::RemoveFile(tempOutputFile.c_str()); + return true; } |