We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b88d65 commit 367d7edCopy full SHA for 367d7ed
library/std/src/sys/windows/fs.rs
@@ -1066,6 +1066,14 @@ impl DirBuilder {
1066
}
1067
1068
pub fn readdir(p: &Path) -> io::Result<ReadDir> {
1069
+ // We push a `*` to the end of the path which cause the empty path to be
1070
+ // treated as the current directory. So, for consistency with other platforms,
1071
+ // we explicitly error on the empty path.
1072
+ if p.as_os_str().is_empty() {
1073
+ // Return an error code consistent with other ways of opening files.
1074
+ // E.g. fs::metadata or File::open.
1075
+ return Err(io::Error::from_raw_os_error(c::ERROR_PATH_NOT_FOUND as i32));
1076
+ }
1077
let root = p.to_path_buf();
1078
let star = p.join("*");
1079
let path = maybe_verbatim(&star)?;
0 commit comments