Skip to content

Commit

Permalink
fix(pkg): read config file on windows
Browse files Browse the repository at this point in the history
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 <me@rgrinberg.com>

<!-- ps-id: 9fe8f78e-d631-4455-99a1-d8549fef563f -->
  • Loading branch information
rgrinberg committed May 9, 2024
1 parent 68d32e1 commit 9377f57
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/dune_rules/pkg_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1309,9 +1309,7 @@ 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
match OpamFile.Dot_config.read_from_string (Io.read_file config_file) with
| s -> s
| exception OpamPp.Bad_format (pos, message) ->
let loc =
Expand All @@ -1325,7 +1323,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 = Path.to_string config_file
; pos_lnum = line
; pos_bol
; pos_cnum = pos_bol + column
Expand Down

0 comments on commit 9377f57

Please sign in to comment.