Use ChangeTime
instead of CreationTime
in mingw_stat()
and fscache_stat()
#3707
Labels
Help Wanted
help is requested from collaborators, please!
As pointed out in this StackOverflow post, Windows'
CreationTime
is less similar to Unix'ctime
concept than we previously assumed: on Windows, it does not necessarily change when a file is deleted and recreated again. Indeed, even when renaming a file and then renaming another file to the former's former name, theCreationTime
won't change.Instead,
ChangeTime
is what we're after. It changes when the file's metadata changes, such as its file name or its location.This should also help the funny issue where editing a file using Excel might not change the
LastWriteTime
, and neither theCreationTime
, but theChangeTime
.Originally, we used
CreationTime
becausectime
was interpreted to mean "create time".Then, we could not change it because we used the
FindFirstFile()
/FindNextFile()
functions in the FSCache, which have access toCreationTime
but not toChangeTime
.In the meantime, however, we use
NtQueryDirectoryFile()
instead (because it is actually faster), which does have access toChangeTime
.The regular non-FSCache
mingw_stat()
usesGetFileInformationByHandle()
, which does not have access to theChangeTime
. We might be able to remedy that by switching toGetFileAttributesExW()
,GetFileInformationByHandleEx()
or some other API function that does have access.Note: we might want to use this opportunity to switch to using
FILE_ID_FULL_DIR_INFORMATION
infscache_stat()
to get the equivalent of inodes, and the equivalentnFileIndexHigh
/nFileIndexLow
inmingw_stat()
.The text was updated successfully, but these errors were encountered: