`path.basename` like function but to get the root of a path