1 | use crate::fs::asyncify; |
2 | |
3 | use std::io; |
4 | use std::path::Path; |
5 | |
6 | /// Creates a new symbolic link on the filesystem. |
7 | /// |
8 | /// The `dst` path will be a symbolic link pointing to the `src` path. |
9 | /// |
10 | /// This is an async version of [`std::os::unix::fs::symlink`]. |
11 | pub async fn symlink(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Result<()> { |
12 | let src: PathBuf = src.as_ref().to_owned(); |
13 | let dst: PathBuf = dst.as_ref().to_owned(); |
14 | |
15 | asyncify(move || std::os::unix::fs::symlink(original:src, link:dst)).await |
16 | } |
17 | |