It'd be better to get the path only within the `if` block. Better still, it'd be better to use a `PathSupplier` to only compute the path if checking permissions needs it.