use std::io;
const ENOTDIR: i32 = 20;
pub(in crate::system::local) fn is_not_found(error: &io::Error) -> bool {
error.kind() == io::ErrorKind::NotFound || (cfg!(unix) && error.raw_os_error() == Some(ENOTDIR))
}
#[cfg(test)]
mod tests {
use super::{is_not_found, ENOTDIR};
use std::io;
use std::io::ErrorKind;
#[test]
fn is_not_found_matches_missing_paths() {
assert!(is_not_found(&io::Error::from(ErrorKind::NotFound)));
assert_eq!(
is_not_found(&io::Error::from_raw_os_error(ENOTDIR)),
cfg!(unix)
);
assert!(!is_not_found(&io::Error::from(ErrorKind::PermissionDenied)));
}
}