Generalize BasePath logic.