1
Fork 0

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:
Chris Denton 2021-03-17 03:52:02 +00:00
parent 3e827cc21e
commit 2c2c1593ac
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
8 changed files with 43 additions and 8 deletions

View file

@ -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.