Ensure that the baseDir for createNewItem is within the project.

This is a fix for #9910.
:+1: got it