Check if name matches before resolving path

Path resolution hits the filesystem so check for a name
match first.