Browse Source

ENH: If configure file fails do not create directory

Andy Cedilnik 21 years ago
parent
commit
4a1f15c344
3 changed files with 13 additions and 4 deletions
  1. 7 3
      Source/cmConfigureFileCommand.cxx
  2. 1 1
      Source/cmConfigureFileCommand.h
  3. 5 0
      Source/cmMakefile.cxx

+ 7 - 3
Source/cmConfigureFileCommand.cxx

@@ -56,7 +56,11 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args)
   // first pass (now).
   // first pass (now).
   if(m_Immediate)
   if(m_Immediate)
     {
     {
-    this->ConfigureFile();
+    if ( !this->ConfigureFile() )
+      {
+      this->SetError("Problem configuring file");
+      return false;
+      }
     }
     }
   
   
   return true;
   return true;
@@ -70,9 +74,9 @@ void cmConfigureFileCommand::FinalPass()
     }
     }
 }
 }
 
 
-void cmConfigureFileCommand::ConfigureFile()
+int cmConfigureFileCommand::ConfigureFile()
 {
 {
-  m_Makefile->ConfigureFile(m_InputFile.c_str(),
+  return m_Makefile->ConfigureFile(m_InputFile.c_str(),
     m_OuputFile.c_str(),
     m_OuputFile.c_str(),
     m_CopyOnly,
     m_CopyOnly,
     m_AtOnly,
     m_AtOnly,

+ 1 - 1
Source/cmConfigureFileCommand.h

@@ -76,7 +76,7 @@ public:
 
 
   virtual void FinalPass();
   virtual void FinalPass();
 private:
 private:
-  void ConfigureFile();
+  int ConfigureFile();
   
   
   std::string m_InputFile;
   std::string m_InputFile;
   std::string m_OuputFile;
   std::string m_OuputFile;

+ 5 - 0
Source/cmMakefile.cxx

@@ -2285,6 +2285,11 @@ void cmMakefile::ConfigureString(const std::string& input,
 int cmMakefile::ConfigureFile(const char* infile, const char* outfile, 
 int cmMakefile::ConfigureFile(const char* infile, const char* outfile, 
   bool copyonly, bool atOnly, bool escapeQuotes)
   bool copyonly, bool atOnly, bool escapeQuotes)
 {
 {
+  if ( !cmSystemTools::FileExists(infile) )
+    {
+    cmSystemTools::Error("File ", infile, " does not exist.");
+    return 0;
+    }
   std::string soutfile = outfile;
   std::string soutfile = outfile;
   std::string sinfile = infile;
   std::string sinfile = infile;
   this->AddCMakeDependFile(infile);
   this->AddCMakeDependFile(infile);