2019-08-04 11:24:30 -07:00
|
|
|
use crate::asyncify;
|
|
|
|
|
|
2018-08-01 06:39:27 +02:00
|
|
|
use std::io;
|
|
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
|
|
|
|
|
|
/// Reads a symbolic link, returning the file that the link points to.
|
|
|
|
|
///
|
|
|
|
|
/// This is an async version of [`std::fs::read_link`][std]
|
|
|
|
|
///
|
|
|
|
|
/// [std]: https://doc.rust-lang.org/std/fs/fn.read_link.html
|
2019-08-04 11:24:30 -07:00
|
|
|
pub async fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
2019-08-27 12:25:20 -07:00
|
|
|
let path = path.as_ref().to_owned();
|
|
|
|
|
asyncify(move || std::fs::read_link(path)).await
|
2018-08-01 06:39:27 +02:00
|
|
|
}
|