func SplitCommonRoot(paths []Path) (Path, []Path) {
	root := LongestCommonPrefix(paths)
	if len(root) == 0 {
		return root, paths
	}
	result := make([]Path, len(paths))
	for i, p := range paths {
		result[i] = p[len(root):]
	}
	return root, result
}
SplitCommonRoot finds the longest command whole-segment prefix of the provided
path and returns that along with each path stripped of that prefix.
package path
import (
	"path/filepath"
	"strings"
)
type Path []string
func New(s string) Path {
	s = filepath.ToSlash(filepath.Clean(s))
	switch {
	case s == "", s == ".":
		return nil
	case s == "/":
		return Path{"/"}
	case s[0] == '/':
		return append(Path{"/"}, strings.Split(s[1:], "/")...)
	default:
		return strings.Split(s, "/")
	}
}
func ToPaths(paths []string) []Path {
	split := make([]Path, len(paths))
	for i, p := range paths {
		split[i] = New(p)
	}
	return split
}
func (p Path) LessThan(o Path) bool {
	for i := 0; ; i++ {
		if i >= len(p) {
			return i < len(o)
		} else if i >= len(o) {
			return false
		} else if p[i] != o[i] {
			return p[i] < o[i]
		}
	}
	return false
}
func (p Path) String() string {
	if len(p) == 0 {
		return "."
	}
	return filepath.Join([]string(p)...)
}
func Append(p Path, ps ...Path) Path {
	for _, e := range ps {
		if len(e) > 0 && e[0] == "/" {
			e = e[1:]
		}
		p = append(p, e...)
	}
	return p
}
func AppendString(p Path, elem ...string) Path {
	return Append(p, ToPaths(elem)...)
}
func Join(p Path, ps ...Path) Path {
	if len(ps) == 0 {
		return p[:]
	}
	return Append(p[:], ps...)
}
func JoinString(p Path, elem ...string) Path {
	return Join(p, ToPaths(elem)...)
}