pub fn common_path_all<'a>(
    paths: impl IntoIterator<Item = &'a Path>
) -> Option<PathBuf>
Expand description

Find the common prefix, if any, between any number of paths

Example

use std::path::{PathBuf, Path};
use common_path::common_path_all;

let baz = Path::new("/foo/bar/baz");
let quux = Path::new("/foo/bar/quux");
let foo = Path::new("/foo/bar/foo");
let prefix = common_path_all(vec![baz, quux, foo]).unwrap();
assert_eq!(prefix, Path::new("/foo/bar").to_path_buf());