rune/languageserver/
fs.rs

1use std::io;
2use std::path::Path;
3
4/// Test if the given path is a file.
5pub(super) async fn is_file<P>(path: P) -> io::Result<bool>
6where
7    P: AsRef<Path>,
8{
9    match tokio::fs::metadata(path).await {
10        Ok(m) => Ok(m.is_file()),
11        Err(e) if e.kind() == io::ErrorKind::NotFound => Ok(false),
12        Err(e) => Err(e),
13    }
14}