[Cmake-commits] [cmake-commits] king committed SystemTools.cxx 1.240 1.241

cmake-commits at cmake.org cmake-commits at cmake.org
Wed May 13 10:30:39 EDT 2009


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

Modified Files:
	SystemTools.cxx 
Log Message:
BUG: Fix removal of read-only directories

Read-only directories must be given write permission before we can
remove files and subdirectories from them.


Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.240
retrieving revision 1.241
diff -C 2 -d -r1.240 -r1.241
*** SystemTools.cxx	23 Apr 2009 15:09:36 -0000	1.240
--- SystemTools.cxx	13 May 2009 14:30:33 -0000	1.241
***************
*** 2104,2107 ****
--- 2104,2120 ----
  bool SystemTools::RemoveADirectory(const char* source)
  {
+   // Add write permission to the directory so we can modify its
+   // content to remove files and directories from it.
+   mode_t mode;
+   if(SystemTools::GetPermissions(source, mode))
+     {
+ #if defined(_WIN32) && !defined(__CYGWIN__)
+     mode |= S_IWRITE;
+ #else
+     mode |= S_IWUSR;
+ #endif
+     SystemTools::SetPermissions(source, mode);
+     }
+ 
    Directory dir;
    dir.Load(source);



More information about the Cmake-commits mailing list