summaryrefslogtreecommitdiffstats
path: root/Source/kwsys
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-10-27 17:57:48 (GMT)
committerBrad King <brad.king@kitware.com>2005-10-27 17:57:48 (GMT)
commit946c9a2cc664f9628d2dcb8161f639cf32b4ca71 (patch)
tree21edc8b7a1034a209a54a9a0bb94dc9c610b589f /Source/kwsys
parent6b0c50e824914701c3b341e24f3dc79c302a9818 (diff)
downloadCMake-946c9a2cc664f9628d2dcb8161f639cf32b4ca71.zip
CMake-946c9a2cc664f9628d2dcb8161f639cf32b4ca71.tar.gz
CMake-946c9a2cc664f9628d2dcb8161f639cf32b4ca71.tar.bz2
ENH: Improved file modification time comparison on Windows to use GetFileAttributesEx instead of CreateFile/GetFileTime/CloseHandle to get file times. This results in a 30% reduction in time to do a build system check.
Diffstat (limited to 'Source/kwsys')
-rw-r--r--Source/kwsys/SystemTools.cxx30
1 files changed, 6 insertions, 24 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index ae3154a..df8f137 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -786,38 +786,20 @@ bool SystemTools::FileTimeCompare(const char* f1, const char* f2,
}
# endif
#else
- // Windows version. Create file handles and get the modification times.
- HANDLE hf1 = CreateFile(f1, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS,
- NULL);
- if(hf1 == INVALID_HANDLE_VALUE)
+ // Windows version. Get the modification time from extended file attributes.
+ WIN32_FILE_ATTRIBUTE_DATA f1d;
+ WIN32_FILE_ATTRIBUTE_DATA f2d;
+ if(!GetFileAttributesEx(f1, GetFileExInfoStandard, &f1d))
{
return false;
}
- FILETIME tf1;
- if(!GetFileTime(hf1, 0, 0, &tf1))
+ if(!GetFileAttributesEx(f2, GetFileExInfoStandard, &f2d))
{
- CloseHandle(hf1);
return false;
}
- CloseHandle(hf1);
- HANDLE hf2 = CreateFile(f2, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS,
- NULL);
- if(hf2 == INVALID_HANDLE_VALUE)
- {
- return false;
- }
- FILETIME tf2;
- if(!GetFileTime(hf2, 0, 0, &tf2))
- {
- CloseHandle(hf2);
- return false;
- }
- CloseHandle(hf2);
// Compare the file times using resolution provided by system call.
- *result = (int)CompareFileTime(&tf1, &tf2);
+ *result = (int)CompareFileTime(&f1d.ftLastWriteTime, &f2d.ftLastWriteTime);
#endif
return true;
}