Generates require functions that act as if they were operating in a given path.