replace the common path among all provided paths by transforming it with a custom map_fn function.
all paths are initially normalized and converted into posix-style (so that no "\" windows separator is prevelent).
the map_fn function's first argument (path_info), is a 2-tuple of the form [common_dir: string, subpath: string],
where common_dir represents the directory common to all of the input paths, and the subpath represents the remaining relative path that comes after common_dir.
the common_dir always ends with a trailing slash ("/"), unless there is absolutely no common directory among the paths at all.
the subpath never begins with any slash (nor any dot-slashes), unless of course, you had initially provided a path containing two or more consecutive slashes.
replace the common path among all provided
paths
by transforming it with a custommap_fn
function. allpaths
are initially normalized and converted into posix-style (so that no "\" windows separator is prevelent).the
map_fn
function's first argument (path_info
), is a 2-tuple of the form[common_dir: string, subpath: string]
, wherecommon_dir
represents the directory common to all of the inputpaths
, and thesubpath
represents the remaining relative path that comes after common_dir.common_dir
always ends with a trailing slash ("/"), unless there is absolutely no common directory among thepaths
at all.subpath
never begins with any slash (nor any dot-slashes), unless of course, you had initially provided a path containing two or more consecutive slashes.Example