[][src]Function fungus::sys::paths

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

Returns all directories/files for the given path, sorted by filename. Handles path expansion. Paths are returned as abs paths. Doesn't include the path itself only its children nor is this recursive.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("path_doc_paths");
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::paths(&tmpdir).unwrap(), vec![dir1, dir2, file1]);
assert!(sys::remove_all(&tmpdir).is_ok());