Detect if file doesn't exist/path is a directory instead of just showing filesystem error message.