Hmmm - I think there's an (existing) bug here.

path: `foo/bar/baz/bar`, file: `bar`

I think we need `lastIndexOf()`.