Function ethers_solc::utils::common_ancestor
source · pub fn common_ancestor(
a: impl AsRef<Path>,
b: impl AsRef<Path>
) -> Option<PathBuf>
Expand description
Finds the common ancestor of both paths
§Example
use std::path::{PathBuf, Path};
use ethers_solc::utils::common_ancestor;
let foo = Path::new("/foo/bar/foo");
let bar = Path::new("/foo/bar/bar");
let ancestor = common_ancestor(foo, bar).unwrap();
assert_eq!(ancestor, Path::new("/foo/bar").to_path_buf());