Sfoglia il codice sorgente

Merge topic 'install-fail-reason'

891e670e59 install: print reason of failure

Acked-by: Kitware Robot <[email protected]>
Acked-by: Alex Turbov <[email protected]>
Merge-request: !3696
Brad King 6 anni fa
parent
commit
ea4c3976fb
1 ha cambiato i file con 13 aggiunte e 8 eliminazioni
  1. 13 8
      Source/cmFileCopier.cxx

+ 13 - 8
Source/cmFileCopier.cxx

@@ -91,7 +91,8 @@ bool cmFileCopier::SetPermissions(const std::string& toFile,
 
 
     if (!cmSystemTools::SetPermissions(toFile, permissions)) {
     if (!cmSystemTools::SetPermissions(toFile, permissions)) {
       std::ostringstream e;
       std::ostringstream e;
-      e << this->Name << " cannot set permissions on \"" << toFile << "\"";
+      e << this->Name << " cannot set permissions on \"" << toFile
+        << "\": " << cmSystemTools::GetLastSystemError() << ".";
       this->Status.SetError(e.str());
       this->Status.SetError(e.str());
       return false;
       return false;
     }
     }
@@ -121,7 +122,8 @@ bool cmFileCopier::ReportMissing(const std::string& fromFile)
 {
 {
   // The input file does not exist and installation is not optional.
   // The input file does not exist and installation is not optional.
   std::ostringstream e;
   std::ostringstream e;
-  e << this->Name << " cannot find \"" << fromFile << "\".";
+  e << this->Name << " cannot find \"" << fromFile
+    << "\": " << cmSystemTools::GetLastSystemError() << ".";
   this->Status.SetError(e.str());
   this->Status.SetError(e.str());
   return false;
   return false;
 }
 }
@@ -514,7 +516,8 @@ bool cmFileCopier::InstallSymlinkChain(std::string& fromFile,
 
 
       if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) {
       if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) {
         std::ostringstream e;
         std::ostringstream e;
-        e << this->Name << " cannot create symlink \"" << toFile << "\".";
+        e << this->Name << " cannot create symlink \"" << toFile
+          << "\": " << cmSystemTools::GetLastSystemError() << ".";
         this->Status.SetError(e.str());
         this->Status.SetError(e.str());
         return false;
         return false;
       }
       }
@@ -535,7 +538,8 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile,
   if (!cmSystemTools::ReadSymlink(fromFile, symlinkTarget)) {
   if (!cmSystemTools::ReadSymlink(fromFile, symlinkTarget)) {
     std::ostringstream e;
     std::ostringstream e;
     e << this->Name << " cannot read symlink \"" << fromFile
     e << this->Name << " cannot read symlink \"" << fromFile
-      << "\" to duplicate at \"" << toFile << "\".";
+      << "\" to duplicate at \"" << toFile
+      << "\": " << cmSystemTools::GetLastSystemError() << ".";
     this->Status.SetError(e.str());
     this->Status.SetError(e.str());
     return false;
     return false;
   }
   }
@@ -566,7 +570,8 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile,
     if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) {
     if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) {
       std::ostringstream e;
       std::ostringstream e;
       e << this->Name << " cannot duplicate symlink \"" << fromFile
       e << this->Name << " cannot duplicate symlink \"" << fromFile
-        << "\" at \"" << toFile << "\".";
+        << "\" at \"" << toFile
+        << "\": " << cmSystemTools::GetLastSystemError() << ".";
       this->Status.SetError(e.str());
       this->Status.SetError(e.str());
       return false;
       return false;
     }
     }
@@ -595,7 +600,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile,
   if (copy && !cmSystemTools::CopyAFile(fromFile, toFile, true)) {
   if (copy && !cmSystemTools::CopyAFile(fromFile, toFile, true)) {
     std::ostringstream e;
     std::ostringstream e;
     e << this->Name << " cannot copy file \"" << fromFile << "\" to \""
     e << this->Name << " cannot copy file \"" << fromFile << "\" to \""
-      << toFile << "\".";
+      << toFile << "\": " << cmSystemTools::GetLastSystemError() << ".";
     this->Status.SetError(e.str());
     this->Status.SetError(e.str());
     return false;
     return false;
   }
   }
@@ -611,7 +616,7 @@ bool cmFileCopier::InstallFile(const std::string& fromFile,
     if (!cmFileTimes::Copy(fromFile, toFile)) {
     if (!cmFileTimes::Copy(fromFile, toFile)) {
       std::ostringstream e;
       std::ostringstream e;
       e << this->Name << " cannot set modification time on \"" << toFile
       e << this->Name << " cannot set modification time on \"" << toFile
-        << "\"";
+        << "\": " << cmSystemTools::GetLastSystemError() << ".";
       this->Status.SetError(e.str());
       this->Status.SetError(e.str());
       return false;
       return false;
     }
     }
@@ -648,7 +653,7 @@ bool cmFileCopier::InstallDirectory(const std::string& source,
   if (!cmSystemTools::MakeDirectory(destination, default_dir_mode)) {
   if (!cmSystemTools::MakeDirectory(destination, default_dir_mode)) {
     std::ostringstream e;
     std::ostringstream e;
     e << this->Name << " cannot make directory \"" << destination
     e << this->Name << " cannot make directory \"" << destination
-      << "\": " << cmSystemTools::GetLastSystemError();
+      << "\": " << cmSystemTools::GetLastSystemError() << ".";
     this->Status.SetError(e.str());
     this->Status.SetError(e.str());
     return false;
     return false;
   }
   }