rustix::fs

Function link

Source
pub fn link<P: Arg, Q: Arg>(old_path: P, new_path: Q) -> Result<()>
Available on crate feature fs only.
Expand description

link(old_path, new_path)—Creates a hard link.

POSIX leaves it implementation-defined whether link follows a symlink in old_path, or creates a new link to the symbolic link itself. On platforms which have it, linkat avoids this problem since it has an AtFlags parameter and the AtFlags::SYMLINK_FOLLOW flag determines whether symlinks should be followed.

§References