Skip to content

Commit 480ff7d

Browse files
pchickeysunfishcode
authored andcommitted
Use from_raw_os_error for the is_directory / is_not_directory errors on windows
wasi-common was already dispatching ERROR_DIRECTORY to ENOTDIR, so i picked ERROR_DIRECTORY_NOT_SUPPORTED for EISDIR.
1 parent b14a7aa commit 480ff7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cap-primitives/src/windows/fs/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ pub(crate) fn no_such_file_or_directory() -> io::Error {
88

99
#[cold]
1010
pub(crate) fn is_directory() -> io::Error {
11-
io::Error::new(io::ErrorKind::Other, "expected non-directory")
11+
io::Error::from_raw_os_error(winerror::ERROR_DIRECTORY_NOT_SUPPORTED as i32)
1212
}
1313

1414
#[cold]
1515
pub(crate) fn is_not_directory() -> io::Error {
16-
io::Error::new(io::ErrorKind::Other, "expected directory")
16+
io::Error::from_raw_os_error(winerror::ERROR_DIRECTORY as i32)
1717
}
1818

1919
#[cold]

0 commit comments

Comments
 (0)