浏览代码

ENH: handle read only directories with configure file destination

Bill Hoffman 21 年之前
父节点
当前提交
bb316a4945
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6 5
      Source/kwsys/SystemTools.cxx

+ 6 - 5
Source/kwsys/SystemTools.cxx

@@ -994,11 +994,12 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
     {
     {
     return false;
     return false;
     }
     }
-
-  if ( SystemTools::FileExists(destination) && !SystemTools::RemoveFile(destination) )
-    {
-    return false;
-    }
+ 
+  // try and remove the destination file so that read only destination files
+  // can be written to.
+  // If the remove fails continue so that files in read only directories
+  // that do not allow file removal can be modified.
+  SystemTools::RemoveFile(destination);
 
 
 #if defined(_WIN32) || defined(__CYGWIN__)
 #if defined(_WIN32) || defined(__CYGWIN__)
   kwsys_ios::ofstream fout(destination, 
   kwsys_ios::ofstream fout(destination,