[−][src]Function librelic::prelude::sys::copyfile
pub fn copyfile<T, U>(src: T, dst: U) -> Result<(), FuError> where
T: AsRef<Path>,
U: AsRef<Path>,
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());