Use DerivedPath for buildPaths and ensurePath
#4594
Merged
DerivedPath for buildPaths and ensurePath
#4594