A dangling symlink or a concurrent replacement is not proof of absence.
(path: &Path)
| 327 | |
| 328 | // A dangling symlink or a concurrent replacement is not proof of absence. |
| 329 | fn demonstrably_missing(path: &Path) -> bool { |
| 330 | match std::fs::symlink_metadata(path) { |
| 331 | Ok(_) => return false, |
| 332 | Err(error) if error.kind() == ErrorKind::NotFound => {} |
| 333 | Err(_) => return false, |
| 334 | } |
| 335 | for ancestor in path.ancestors().skip(1) { |
| 336 | match std::fs::symlink_metadata(ancestor) { |
| 337 | Ok(metadata) if metadata.file_type().is_symlink() => { |
| 338 | return std::fs::metadata(ancestor).is_ok(); |
| 339 | } |
| 340 | Ok(_) => return true, |
| 341 | Err(error) if error.kind() == ErrorKind::NotFound => {} |
| 342 | Err(_) => return false, |
| 343 | } |
| 344 | } |
| 345 | false |
| 346 | } |
| 347 | |
| 348 | impl Sources { |
| 349 | pub(crate) fn from_process() -> Self { |
no test coverage detected