Opened 12 years ago
Closed 8 years ago
#4610 closed Bugs (wontfix)
filesystem::file_size problem on Windows platform
Reported by: | Owned by: | Beman Dawes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | filesystem |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
This is a subtle problem on Windows platform.
I see that file_size calls GetFileAttributesEx to obtain file size - that works in a chance of 99.99%.
What is the other 0.01%? It's like this - GetFileAttributes(Ex) does not work with system files, say c:\pagefile.sys. It will only return FALSE and GetLastError returns 32 (The process cannot access the file because it is being used by another process. )
Instead, you have to call FindFirstFile which correctly reports file status in all cases.
Note:
See TracTickets
for help on using tickets.
I don't find the system files use case compelling enough to make a change. I'm worried that FindFirstFile may have its own set of problems, such as impacting performance in large directories where the file does not exist. The motivation is too weak to invest the time to test the implications of such a change.
Thanks for your interest in Boost.Filesystem,
--Beman