This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
library/std/src/sys/wasi/ext Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -502,11 +502,21 @@ pub fn rename<P: AsRef<Path>, U: AsRef<Path>>(
502
502
)
503
503
}
504
504
505
+ /// This corresponds to the `path_symlink` syscall.
506
+ pub fn symlink<P: AsRef<Path>, U: AsRef<Path>>(
507
+ old_path: P,
508
+ fd: &File,
509
+ new_path: U,
510
+ ) -> io::Result<()> {
511
+ fd.as_inner()
512
+ .fd()
513
+ .symlink(osstr2str(old_path.as_ref().as_ref())?, osstr2str(new_path.as_ref().as_ref())?)
514
+ }
515
+
505
516
/// Create a symbolic link.
506
517
///
507
- /// This is similar to [`std::os::unix::fs::symlink`] and
508
- /// [`std::os::windows::fs::symlink_file`] and [`symlink_dir`](std::os::windows::fs::symlink_dir)
509
- /// counterparts.
510
- pub fn symlink<P: AsRef<Path>, U: AsRef<Path>>(old_path: P, new_path: U) -> io::Result<()> {
518
+ /// This is a convenience API similar to [`std::os::unix::fs::symlink`] and
519
+ /// [`std::os::windows::fs::symlink_file`] and [`symlink_dir`](std::os::windows::fs::symlink_dir).
520
+ pub fn symlink_path<P: AsRef<Path>, U: AsRef<Path>>(old_path: P, new_path: U) -> io::Result<()> {
511
521
crate::sys::fs::symlink(old_path.as_ref(), new_path.as_ref())
512
522
}
You can’t perform that action at this time.
0 commit comments