True for Windows errors that indicate another process is briefly holding the file: `ERROR_SHARING_VIOLATION` (32) and `ERROR_LOCK_VIOLATION` (33) map through as raw OS errors, while Defender-style scans surface as plain `PermissionDenied` (`ERROR_ACCESS_DENIED`, os error 5).
(err: &std::io::Error)
| 76 | /// map through as raw OS errors, while Defender-style scans surface as plain |
| 77 | /// `PermissionDenied` (`ERROR_ACCESS_DENIED`, os error 5). |
| 78 | fn is_transient_windows_file_lock(err: &std::io::Error) -> bool { |
| 79 | const ERROR_SHARING_VIOLATION: i32 = 32; |
| 80 | const ERROR_LOCK_VIOLATION: i32 = 33; |
| 81 | matches!( |
| 82 | err.raw_os_error(), |
| 83 | Some(ERROR_SHARING_VIOLATION | ERROR_LOCK_VIOLATION) |
| 84 | ) || err.kind() == std::io::ErrorKind::PermissionDenied |
| 85 | } |
| 86 | |
| 87 | /// Get filesystem mtime (seconds since epoch) and size for pre-filter. |
| 88 | pub fn file_stat(path: &Path) -> Option<(i64, u64)> { |