[][src]Function fungus::sys::is_readonly

pub fn is_readonly<T: AsRef<Path>>(path: T) -> bool

Returns true if the given path exists and is readonly. Handles path expansion

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("path_doc_is_readonly");
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(sys::mkdir(&tmpdir).is_ok());
let file1 = tmpdir.mash("file1");
assert!(sys::touch_p(&file1, 0o644).is_ok());
assert_eq!(file1.is_readonly(), false);
assert!(sys::chmod_p(&file1).unwrap().readonly().chmod().is_ok());
assert_eq!(file1.mode().unwrap(), 0o100444);
assert_eq!(sys::is_readonly(&file1), true);
assert!(sys::remove_all(&tmpdir).is_ok());