Look for META files rather than just directories to list plugins
This PR proposes a possible fix for #10457.
If the plugin directory contains anything but directories that each contain a META file, loading plugins fails. This PR proposes to check additionally for the presence of the META files and ignore other entries in the plugin directory.
Thank you for your review!
I wasn’t sure about the best way to test this behaviour. I have added such a possible test, where the empty directory is explicitly created to mimick what happens with OPAM.
Your suggestion to go with filter_map sent me on another exploration. Checking that Sys.file_exists on each candidate directory is not enough to ensure readdir will not fail. So I ended up with the following proposition: just try to Sys.readdir each plugins directory and handle the errors as empty directories.
ping @anmonteiro
Thanks. Can you add a changelog entry in doc/changes/?