Move the implementation of Path::exists
to sys_common::fs
so platforms can specialize it
Windows implementation of `fs::try_exists`
This commit is contained in:
parent
3e827cc21e
commit
2c2c1593ac
8 changed files with 43 additions and 8 deletions
|
@ -2507,11 +2507,7 @@ impl Path {
|
|||
#[unstable(feature = "path_try_exists", issue = "83186")]
|
||||
#[inline]
|
||||
pub fn try_exists(&self) -> io::Result<bool> {
|
||||
match fs::metadata(self) {
|
||||
Ok(_) => Ok(true),
|
||||
Err(error) if error.kind() == io::ErrorKind::NotFound => Ok(false),
|
||||
Err(error) => Err(error),
|
||||
}
|
||||
fs::try_exists(self)
|
||||
}
|
||||
|
||||
/// Returns `true` if the path exists on disk and is pointing at a regular file.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue