The current implementation of stat on Windows using FindFirstFile doesn't really work all that great.
For example: "D:\\home" stat works "D:\\home\\" stat doesn't work Some Googling revealed the following comment: > Use CreateFile() and GetFileInformationByHandle(), rather than > FindFirstFile() like Microsoft's stat() does, for four reasons: > (1) CreateFile() does not require "List Folder Contents" permission on the > parent directory like FindFirstFile() does; > (2) It works for directories specified with a trailing slash or backslash and > it works for root (drive or UNC) directories like C: and \\SERVER\SHARE, with > or without a trailing slash or backslash (provided that this is a Windows NT > platform and the FILE_FLAG_BACKUP_SEMANTICS flag is passed to allow directory > handles to be obtained), whereas FindFirstFile() requires non-root > directories to not have a trailing slash or backslash and requires root > directories to have a trailing \*; and > (3) The BY_HANDLE_FILE_INFORMATION structure returned by > GetFileInformationByHandle() contains the number of links to the file, which > the WIN32_FIND_DATA structure returned by FindFirstFile() does not; and most > importantly > (4) The file times in that structure are correct UTC times on both NTFS and > FAT, whereas on FAT the file times in the WIN32_FIND_DATA structure are > sometimes wrong w.r.t. DST season changes. Comment and source code at: http://search.cpan.org/src/SHAY/Win32-UTCFileTime-1.46/UTCFileTime.xs This seems like a much better approach to me. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
