Fix bug when a directory with the right name appears in the PATH

See https://github.com/ocaml/opam-repository/issues/1306