diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2004-09-07 16:55:25 -0400 |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2004-09-07 16:55:25 -0400 |
commit | b5bdf2cb0ae3bf3e655b76065050763b092d32f7 (patch) | |
tree | 567ae3a8f8c2c8b92769a57834b032bd9f031dd0 /Source | |
parent | 8f92e8c069dcb3cb943144864274ee75bad36c0d (diff) | |
download | cmake-b5bdf2cb0ae3bf3e655b76065050763b092d32f7.tar.gz |
ENH: add better error reporting for file open failures
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCacheManager.cxx | 3 | ||||
-rw-r--r-- | Source/cmDumpDocumentation.cxx | 4 | ||||
-rw-r--r-- | Source/cmEnableTestingCommand.cxx | 1 | ||||
-rw-r--r-- | Source/cmExportLibraryDependencies.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalCodeWarriorGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio6Generator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 1 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 1 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 1 | ||||
-rw-r--r-- | Source/cmTryCompileCommand.cxx | 1 | ||||
-rw-r--r-- | Source/cmUseMangledMesaCommand.cxx | 1 | ||||
-rw-r--r-- | Source/cmVTKWrapPythonCommand.cxx | 1 | ||||
-rw-r--r-- | Source/cmVTKWrapTclCommand.cxx | 1 |
14 files changed, 17 insertions, 2 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index c48d485b25..d441768973 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -327,9 +327,10 @@ bool cmCacheManager::SaveCache(const char* path) tempFile += ".tmp"; std::ofstream fout(tempFile.c_str()); if(!fout) - { + { cmSystemTools::Error("Unable to open cache file for save. ", cacheFile.c_str()); + cmSystemTools::ReportLastSystemError(""); return false; } // before writting the cache, update the version numbers diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx index 0155ac2766..9bfc9fc824 100644 --- a/Source/cmDumpDocumentation.cxx +++ b/Source/cmDumpDocumentation.cxx @@ -60,7 +60,8 @@ int DumpHTML(const char* outname) std::ofstream fout(outname); if(!fout) { - std::cerr << "failed to open output file: " << outname << "\n"; + std::cerr << "failed to open output file: " << outname << "\n"; + cmSystemTools::ReportLastSystemError(""); return -1; } @@ -104,6 +105,7 @@ int DumpForCoverage(const char* outname) if(!fout) { std::cerr << "failed to open output file: " << outname << "\n"; + cmSystemTools::ReportLastSystemError(""); return -1; } return DumpForCoverageToStream(fout); diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx index 05a65456b5..75adee3c26 100644 --- a/Source/cmEnableTestingCommand.cxx +++ b/Source/cmEnableTestingCommand.cxx @@ -39,6 +39,7 @@ void cmEnableTestingCommand::FinalPass() if (!fout) { cmSystemTools::Error("Error Writing ", fname.c_str()); + cmSystemTools::ReportLastSystemError(""); return; } diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index c8b21693e7..364bc286f5 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -82,6 +82,7 @@ void cmExportLibraryDependenciesCommand::FinalPass() if (!fout) { cmSystemTools::Error("Error Writing ", fname.c_str()); + cmSystemTools::ReportLastSystemError(""); return; } cmake* cm = m_Makefile->GetCMakeInstance(); diff --git a/Source/cmGlobalCodeWarriorGenerator.cxx b/Source/cmGlobalCodeWarriorGenerator.cxx index ba7245f3b8..9db7e54a12 100644 --- a/Source/cmGlobalCodeWarriorGenerator.cxx +++ b/Source/cmGlobalCodeWarriorGenerator.cxx @@ -94,6 +94,7 @@ void cmGlobalCodeWarriorGenerator::OutputProject() { cmSystemTools::Error("Error can not open project file for write: " ,fname.c_str()); + cmSystemTools::ReportLastSystemError(""); return; } this->WriteProject(fout); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index a85ea61e98..e40e77d069 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -364,6 +364,7 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile(cmLocalGenerator* root, { cmSystemTools::Error("Error can not open DSW file for write: ", fname.c_str()); + cmSystemTools::ReportLastSystemError(""); return; } this->WriteDSWFile(fout, root, generators); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 26f16dbe84..8b80ee1584 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -291,6 +291,7 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile(cmLocalGenerator* root, { cmSystemTools::Error("Error can not open DSW file for write: ", fname.c_str()); + cmSystemTools::ReportLastSystemError(""); return; } this->WriteSLNFile(fout.GetStream(), root, generators); diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index e5092fe2ad..5d6fc87d26 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -192,6 +192,7 @@ void cmLocalUnixMakefileGenerator::OutputMakefile(const char* file, if(!fout) { cmSystemTools::Error("Error can not open for write: ", file); + cmSystemTools::ReportLastSystemError(""); return; } fout << "# CMAKE generated Makefile, DO NOT EDIT!\n" diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 0febe1b121..beb5889f9f 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -149,6 +149,7 @@ void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, cmTarget if(!fout) { cmSystemTools::Error("Error Writing ", fname.c_str()); + cmSystemTools::ReportLastSystemError(""); } this->WriteDSPFile(fout,lname,target); fout.close(); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0d7c293f74..f4c862ba19 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2396,6 +2396,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, cmSystemTools::Error( "Could not open file for write in copy operation ", tempOutputFile.c_str()); + cmSystemTools::ReportLastSystemError(""); return 0; } std::ifstream fin(sinfile.c_str()); diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index e20ad7ecf7..55ba900160 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -141,6 +141,7 @@ int cmTryCompileCommand::CoreTryCompileCode( { cmSystemTools::Error("Failed to create CMakeList file for ", outFileName.c_str()); + cmSystemTools::ReportLastSystemError(""); return -1; } diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 9556073648..789ff0f2aa 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -80,6 +80,7 @@ CopyAndFullPathMesaHeader(const char* source, { cmSystemTools::Error("Could not open file for write in copy operation: ", tempOutputFile.c_str(), outdir); + cmSystemTools::ReportLastSystemError(""); return; } std::ifstream fin(source); diff --git a/Source/cmVTKWrapPythonCommand.cxx b/Source/cmVTKWrapPythonCommand.cxx index cef310f66d..3bde3068ef 100644 --- a/Source/cmVTKWrapPythonCommand.cxx +++ b/Source/cmVTKWrapPythonCommand.cxx @@ -171,6 +171,7 @@ bool cmVTKWrapPythonCommand::WriteInit(const char *kitName, FILE *fout = fopen(tempOutputFile.c_str(),"w"); if (!fout) { + cmSystemTools::ReportLastSystemError("cmVTKWrapPythonCommand error:"); return false; } diff --git a/Source/cmVTKWrapTclCommand.cxx b/Source/cmVTKWrapTclCommand.cxx index 56503fd3b7..b1e4d1afb8 100644 --- a/Source/cmVTKWrapTclCommand.cxx +++ b/Source/cmVTKWrapTclCommand.cxx @@ -219,6 +219,7 @@ bool cmVTKWrapTclCommand::WriteInit(const char *kitName, if (!fout) { cmSystemTools::Error("Failed to open TclInit file for ", tempOutputFile.c_str()); + cmSystemTools::ReportLastSystemError(""); return false; } |