[][src]Function fungus::sys::touch_p

pub fn touch_p<T: AsRef<Path>>(path: T, mode: u32) -> Result<PathBuf>

Wraps touch allowing for setting the file's mode.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_touch");
assert!(sys::remove_all(&tmpdir).is_ok());
let tmpfile = tmpdir.mash("file1");
assert!(sys::mkdir(&tmpdir).is_ok());
assert!(sys::touch_p(&tmpfile, 0o555).is_ok());
assert_eq!(tmpfile.mode().unwrap(), 0o100555);
assert!(sys::remove_all(&tmpdir).is_ok());