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 13, 2024
1 parent d43d011 commit f867362
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/dune_rules/pkg_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1309,9 +1309,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 =
Expand All @@ -1325,7 +1328,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
Expand Down

0 comments on commit f867362

Please sign in to comment.