Thinking out loud: could detecting the path be done before the `read` is called?