`$dir` needs to be checked.