Re-add check for ignored folders when validating a package

For #5393. @dangoor 

It looks like `findCommonPrefix()` has morphed so that it only looks at the top-level folders inside the package (I think maybe it used to find the largest common prefix?), so I just followed that logic. But maybe it should be renamed to something like `findSingleSubfolder()`?