[−][src]Function fungus::sys::symlink
pub fn symlink<T: AsRef<Path>, U: AsRef<Path>>(
link: T,
target: U
) -> FuResult<PathBuf>
Creates a new symbolic link. Handles path expansion and returns an absolute path to the link while still creating the symbolic link as a relative path to the target.
Examples
use fungus::prelude::*; let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_symlink"); assert!(sys::remove_all(&tmpdir).is_ok()); let file1 = tmpdir.mash("file1"); let link1 = tmpdir.mash("link1"); assert!(sys::mkdir(&tmpdir).is_ok()); assert!(sys::touch(&file1).is_ok()); assert!(sys::symlink(&link1, &file1).is_ok()); assert_eq!(link1.exists(), true); assert!(sys::remove_all(&tmpdir).is_ok());