File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,18 @@ pub fn is_executable(metadata: &std::fs::Metadata) -> bool {
83
83
( metadata. mode ( ) & 0o100 ) != 0
84
84
}
85
85
86
+ /// Classifiers for IO-errors.
87
+ pub mod io_err {
88
+ use std:: io:: ErrorKind ;
89
+
90
+ /// Return `true` if `err` indicates that the entry doesn't exist on disk. `raw` is used as well
91
+ /// for additional checks while the variants are outside the MSRV.
92
+ pub fn is_not_found ( err : ErrorKind , raw_err : Option < i32 > ) -> bool {
93
+ // TODO: use variant once MSRV is 1.83
94
+ err == ErrorKind :: NotFound || raw_err == Some ( 20 )
95
+ }
96
+ }
97
+
86
98
#[ cfg( not( unix) ) ]
87
99
/// Returns whether a a file has the executable permission set.
88
100
pub fn is_executable ( _metadata : & std:: fs:: Metadata ) -> bool {
You can’t perform that action at this time.
0 commit comments