[][src]Function fungus::sys::all_paths

pub fn all_paths<T: AsRef<Path>>(path: T) -> FuResult<Vec<PathBuf>>

Returns all paths for the given path recursively, sorted by filename. Handles path expansion. Paths are returned as abs paths. Doesn't include the path itself. Paths are guaranteed to be distinct.

Examples

use fungus::prelude::*;

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