Why isn't this expression changed to be:

  if (!file.delete() && file.exists())

?  If the file doesn't delete and doesn't exist, why shouldn't we fall through to the else case below for isSamePrefix() removeEmptyParents?  If the file deletion failed because its already gone, then the parent might be empty and we might be able to remove it.