[Cmake-commits] [cmake-commits] king committed cmFileCommand.cxx 1.125 1.126

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Apr 29 08:47:06 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv30822/Source

Modified Files:
	cmFileCommand.cxx 
Log Message:
ENH: Better error on file perm or time failure

This improves the error message produced during installation when CMake
cannot set file modification time or permissions.


Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.125
retrieving revision 1.126
diff -C 2 -d -r1.125 -r1.126
*** cmFileCommand.cxx	29 Apr 2009 12:46:56 -0000	1.125
--- cmFileCommand.cxx	29 Apr 2009 12:47:04 -0000	1.126
***************
*** 1001,1004 ****
--- 1001,1016 ----
      }
  
+   bool SetPermissions(const char* toFile, mode_t permissions)
+     {
+     if(permissions && !cmSystemTools::SetPermissions(toFile, permissions))
+       {
+       cmOStringStream e;
+       e << "INSTALL cannot set permissions on \"" << toFile << "\"";
+       this->FileCommand->SetError(e.str().c_str());
+       return false;
+       }
+     return true;
+     }
+ 
    // Translate an argument to a permissions bit.
    bool CheckPermissions(std::string const& arg, mode_t& permissions)
***************
*** 1139,1143 ****
        {
        cmOStringStream e;
!       e << "Problem setting modification time on file \"" << toFile << "\"";
        this->FileCommand->SetError(e.str().c_str());
        return false;
--- 1151,1155 ----
        {
        cmOStringStream e;
!       e << "INSTALL cannot set modification time on \"" << toFile << "\"";
        this->FileCommand->SetError(e.str().c_str());
        return false;
***************
*** 1154,1166 ****
      cmSystemTools::GetPermissions(fromFile, permissions);
      }
!   if(permissions && !cmSystemTools::SetPermissions(toFile, permissions))
!     {
!     cmOStringStream e;
!     e << "Problem setting permissions on file \"" << toFile << "\"";
!     this->FileCommand->SetError(e.str().c_str());
!     return false;
!     }
! 
!   return true;
  }
  
--- 1166,1170 ----
      cmSystemTools::GetPermissions(fromFile, permissions);
      }
!   return this->SetPermissions(toFile, permissions);
  }
  
***************
*** 1231,1241 ****
  
    // Set the required permissions of the destination directory.
!   if(permissions_before &&
!      !cmSystemTools::SetPermissions(destination, permissions_before))
      {
-     cmOStringStream e;
-     e << "Problem setting permissions on directory \""
-       << destination << "\"";
-     this->FileCommand->SetError(e.str().c_str());
      return false;
      }
--- 1235,1240 ----
  
    // Set the required permissions of the destination directory.
!   if(!this->SetPermissions(destination, permissions_before))
      {
      return false;
      }
***************
*** 1281,1294 ****
  
    // Set the requested permissions of the destination directory.
!   if(permissions_after &&
!      !cmSystemTools::SetPermissions(destination, permissions_after))
!     {
!     cmOStringStream e;
!     e << "Problem setting permissions on directory \"" << destination << "\"";
!     this->FileCommand->SetError(e.str().c_str());
!     return false;
!     }
! 
!   return true;
  }
  
--- 1280,1284 ----
  
    // Set the requested permissions of the destination directory.
!   return this->SetPermissions(destination, permissions_after);
  }
  



More information about the Cmake-commits mailing list