pub fn path_common<'a, I>(paths: I) -> Option<String>Expand description
Finds the common directory path among a collection of paths.
Given an iterator of path strings, this function determines the common directory
path shared by all paths. If no common directory path exists, it returns None.
§Arguments
paths- An iterator of path strings (&str).
§Returns
Option< String >- The common directory path shared by all paths, if it exists. If no common directory path exists, returnsNone.
§Examples
use pth ::path ::path_common;
let paths = vec![ "/a/b/c", "/a/b/d", "/a/b/e" ];
let common_path = path_common( paths.into_iter() );
assert_eq!( common_path, Some( "/a/b/".to_string() ) );