pub fn file_uri_ancestors_between(
root: &FileUri,
target: &FileUri,
) -> Vec<FileUri>Expand description
Returns the inclusive, root-to-target URI chain when root is an ancestor.
Non-descendants return an empty vector. The output is stable and deduplicated.
ยงExamples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::file_uri_ancestors_between;
let root = FileUri::parse("file:///repo")?;
let target = FileUri::parse("file:///repo/src/lib.rs")?;
let paths: Vec<_> = file_uri_ancestors_between(&root, &target).into_iter().map(|u| u.path().to_owned()).collect();
assert_eq!(paths, ["/repo", "/repo/src", "/repo/src/lib.rs"]);