瀏覽代碼

SystemTools: set time file permissions

On Windows if file permissions are read only
FILE_WRITE_ATTRIBUTES will enables us to
get file handle and change file time.
Domen Vrankar 10 年之前
父節點
當前提交
19c6f4eefc
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Source/cmSystemTools.cxx

+ 2 - 2
Source/cmSystemTools.cxx

@@ -2048,7 +2048,7 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile)
                 OPEN_EXISTING, 0, 0);
                 OPEN_EXISTING, 0, 0);
   cmSystemToolsWindowsHandle hTo =
   cmSystemToolsWindowsHandle hTo =
     CreateFileW(SystemTools::ConvertToWindowsExtendedPath(toFile).c_str(),
     CreateFileW(SystemTools::ConvertToWindowsExtendedPath(toFile).c_str(),
-                GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
+                FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, 0, 0);
   if(!hFrom || !hTo)
   if(!hFrom || !hTo)
     {
     {
     return false;
     return false;
@@ -2127,7 +2127,7 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t)
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #if defined(_WIN32) && !defined(__CYGWIN__)
   cmSystemToolsWindowsHandle h =
   cmSystemToolsWindowsHandle h =
     CreateFileW(SystemTools::ConvertToWindowsExtendedPath(fname).c_str(),
     CreateFileW(SystemTools::ConvertToWindowsExtendedPath(fname).c_str(),
-                GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
+                FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, 0, 0);
   if(!h)
   if(!h)
     {
     {
     return false;
     return false;