Ensure that the baseDir for createNewItem is within the project.

This is a fix for #9910.