What's the motivation to add path.isEmpty() here?