Here is a patch with an implementation of ospathcommonpath  along with tests and documentation At the moment  this is only implemented for POSIX  as I don't feel like I know enough about Windows to tackle drive letters and UNC in paths without spending some more time on it