[][src]Function fungus::sys::copyfile

pub fn copyfile<T: AsRef<Path>, U: AsRef<Path>>(src: T, dst: U) -> FuResult<()>

Wraps copyfile_p to copy the given src to the given dst. Disables follow_links and uses the source mode rather than an optionally set one.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_copyfile");
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(sys::mkdir(&tmpdir).is_ok());
let file1 = tmpdir.mash("file1");
let file2 = tmpdir.mash("file2");
assert!(sys::touch(&file1).is_ok());
assert!(sys::copyfile(&file1, &file2).is_ok());
assert_eq!(file2.exists(), true);
assert_eq!(file1.mode().unwrap(), file2.mode().unwrap());
assert!(sys::remove_all(&tmpdir).is_ok());