Skip to content

Commit

Permalink
Revert to old impl that works for 1.49.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkassimo committed Feb 20, 2023
1 parent adf82da commit e8dbee0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tokio/src/fs/try_exists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ use std::path::Path;
/// # Ok(())
/// # }
/// ```
pub async fn try_exists(path: impl AsRef<Path>) -> io::Result<bool> {
let path = path.as_ref().to_owned();
asyncify(move || path.as_path().try_exists()).await
match asyncify(move || std::fs::metadata(path)).await {
Ok(_) => Ok(true),
Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(false),
Err(error) => Err(error),
}
}

0 comments on commit e8dbee0

Please sign in to comment.