Function
Split a path into components. Note this is more complex than just split() because it takes into account path escaping.