[][src]Function fungus::sys::glob

pub fn glob<T: AsRef<Path>>(src: T) -> FuResult<Vec<PathBuf>>

Returns a vector of all paths from the given target glob with path expansion and sorted by name. Doesn't include the target itself only its children nor is this recursive.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("path_doc_glob");
assert!(sys::remove_all(&tmpdir).is_ok());
let dir1 = tmpdir.mash("dir1");
let dir2 = tmpdir.mash("dir2");
let file1 = tmpdir.mash("file1");
assert!(sys::mkdir(&dir1).is_ok());
assert!(sys::mkdir(&dir2).is_ok());
assert!(sys::touch(&file1).is_ok());
assert_iter_eq(sys::glob(tmpdir.mash("*")).unwrap(), vec![dir1, dir2, file1]);
assert!(sys::remove_all(&tmpdir).is_ok());