make-path-generator helper function