[−][src]Function skellige::prelude::sys::writelines_p
pub fn writelines_p<T>(
path: T,
data: &[String],
mode: u32
) -> Result<(), FuError> where
T: AsRef<Path>,
Wraps writelines
allowing for setting the file's mode.
Examples
use fungus::prelude::*; let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_writelines_p"); assert!(sys::remove_all(&tmpdir).is_ok()); let tmpfile = tmpdir.mash("file1"); assert!(sys::mkdir(&tmpdir).is_ok()); let lines = vec![String::from("one"), String::from("two")]; assert!(sys::writelines_p(&tmpfile, &lines, 0o666).is_ok()); assert_iter_eq(sys::readlines(&tmpfile).unwrap(), lines); assert_eq!(tmpfile.mode().unwrap(), 0o100666); assert!(sys::remove_all(&tmpdir).is_ok());