Use getParentFile rather than getParent
so that we can compare objects of the correct types.