[][src]Function fungus::sys::chmod

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

Wraps chmod_p to apply the given mode to all files/dirs using recursion and invoking the mode change on the close of this function call.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_chmod");
assert!(sys::remove_all(&tmpdir).is_ok());
let file1 = tmpdir.mash("file1");
assert!(sys::mkdir(&tmpdir).is_ok());
assert!(sys::touch(&file1).is_ok());
assert!(sys::chmod(&file1, 0o644).is_ok());
assert_eq!(file1.mode().unwrap(), 0o100644);
assert!(sys::chmod(&file1, 0o555).is_ok());
assert_eq!(file1.mode().unwrap(), 0o100555);
assert!(sys::remove_all(&tmpdir).is_ok());