[][src]Function fungus::sys::is_exec

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

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

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("path_doc_is_exec");
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!(sys::is_exec(&file1), false);
assert!(sys::chmod_p(&file1).unwrap().add_x().chmod().is_ok());
assert_eq!(file1.mode().unwrap(), 0o100755);
assert_eq!(file1.is_exec(), true);
assert!(sys::remove_all(&tmpdir).is_ok());