Skip to content

Commit e9494dc

Browse files
authored
chore(services/fs): use NotADirectory directly (#6786)
1 parent d0eddb2 commit e9494dc

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

core/src/services/fs/core.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -166,30 +166,14 @@ impl FsCore {
166166
match e.kind() {
167167
// Return empty list if the directory not found
168168
std::io::ErrorKind::NotFound => Ok(None),
169-
// TODO: enable after our MSRV has been raised to 1.83
170-
//
171169
// If the path is not a directory, return an empty list
172170
//
173171
// The path could be a file or a symbolic link in this case.
174172
// Returning a NotADirectory error to the user isn't helpful; instead,
175173
// providing an empty directory is a more user-friendly. In fact, the dir
176174
// `path/` does not exist.
177-
// std::io::ErrorKind::NotADirectory => Ok((RpList::default(), None)),
178-
_ => {
179-
// TODO: remove this after we have MSRV 1.83
180-
#[cfg(unix)]
181-
if e.raw_os_error() == Some(20) {
182-
// On unix 20: Not a directory
183-
return Ok(None);
184-
}
185-
#[cfg(windows)]
186-
if e.raw_os_error() == Some(267) {
187-
// On windows 267: DIRECTORY
188-
return Ok(None);
189-
}
190-
191-
Err(new_std_io_error(e))
192-
}
175+
std::io::ErrorKind::NotADirectory => Ok(None),
176+
_ => Err(new_std_io_error(e)),
193177
}
194178
}
195179
}

0 commit comments

Comments
 (0)