Skip to content

Commit

Permalink
Look for META files rather than just directories to list plugins
Browse files Browse the repository at this point in the history
If the plugin directory contains anything but directories that each
contain a `META` file, loading plugins fails

This can happen naturally in particular in the following scenario:
- install a package providing a plugin to a command in another package
- and remove that plugin package.
This leaves an empty directory which triggers that failure.
  • Loading branch information
shym committed Apr 25, 2024
1 parent 8e9ea79 commit d46c45b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions otherlibs/dune-site/src/plugins/plugins.ml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
open Dune_site.Private_
module Data = Dune_site_plugins_data

let meta_fn = "META"

let readdir dirs =
let ( / ) = Filename.concat in
List.concat
(List.map
(fun dir -> Array.to_list (Sys.readdir dir))
(fun dir ->
List.filter
(fun entry -> Sys.file_exists (dir / entry / meta_fn))
(Array.to_list (Sys.readdir dir)))
(List.filter Sys.file_exists dirs))
;;

Expand Down Expand Up @@ -208,8 +214,6 @@ let load file ~pkg =
{ Meta_parser.name = Some pkg; entries }
;;

let meta_fn = "META"

let lookup_and_load_one_dir ~dir ~pkg =
let meta_file = Filename.concat dir meta_fn in
if Sys.file_exists meta_file
Expand Down

0 comments on commit d46c45b

Please sign in to comment.