From 29eecf2b1ed218d5c027625579c0c05771894b41 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 14 May 2024 16:57:19 -0600 Subject: [PATCH] fix(pkg): read config file on windows (#10500) Do not use OpamFile.Dot_config.read as it relies on some stubs to resolve paths in a special way we don't need. Signed-off-by: Rudi Grinberg --- src/dune_rules/pkg_rules.ml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/dune_rules/pkg_rules.ml b/src/dune_rules/pkg_rules.ml index cf5c71eb357..e96c155e907 100644 --- a/src/dune_rules/pkg_rules.ml +++ b/src/dune_rules/pkg_rules.ml @@ -1315,9 +1315,12 @@ module Install_action = struct | false -> [] | true -> let config = - let config_file_str = Path.to_string config_file in - let file = OpamFilename.of_string config_file_str |> OpamFile.make in - match OpamFile.Dot_config.read file with + let filename = Path.to_string config_file in + match + Io.read_file config_file + |> OpamFile.Dot_config.read_from_string + ~filename:(OpamFile.make (OpamFilename.of_string filename)) + with | s -> s | exception OpamPp.Bad_format (pos, message) -> let loc = @@ -1331,7 +1334,7 @@ module Install_action = struct let bols = Array.of_list (List.rev !bols) in let make_pos (line, column) = let pos_bol = bols.(line - 1) in - { Lexing.pos_fname = config_file_str + { Lexing.pos_fname = filename ; pos_lnum = line ; pos_bol ; pos_cnum = pos_bol + column