Reuse pathtype detection in `Path` module