Ensure that the baseDir for createNewItem is within the project.

This is a fix for #9910.
Yep, this function always returns a valid directory in the project.