Skip to content

Commit

Permalink
Windows handling for specific env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 authored and rjbou committed Jun 12, 2023
1 parent 911b95d commit fd429e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ users)
* Update Windows-on-Windows detection for ARM [#5541 @dra27]
* Overhaul parent process detection [#5541 @dra27]
* Tweak UTF-8 support for Windows Terminal [#5541 @dra27]
* Handle Windows specific environment variables [#5541 @dra27]

## Test
* Update crowbar with compare functions [#4918 @rjbou]
Expand Down
16 changes: 13 additions & 3 deletions src/state/opamEnv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ type _ env_classification =
| Separator : char env_classification
| Split : (string -> string list) env_classification

let get_env_property : type s . string -> s env_classification -> s = fun _ classification ->
let get_env_property : type s . string -> s env_classification -> s = fun var classification ->
let split_delim = Fun.flip OpamStd.String.split in
let separator, split =
match String.uppercase_ascii var with
| "CAML_LD_LIBRARY_PATH" ->
OpamStd.Sys.path_sep, split_delim OpamStd.Sys.path_sep
| "PKG_CONFIG_PATH" | "MANPATH" ->
':', split_delim ':'
| _ ->
OpamStd.Sys.path_sep, OpamStd.Sys.split_path_variable ~clean:false
in
match classification with
| Separator -> OpamStd.Sys.path_sep
| Split -> OpamStd.Sys.split_path_variable ~clean:false
| Separator -> separator
| Split -> split

let split_var (var : OpamStd.Env.Name.t) =
get_env_property (var :> string) Split
Expand Down

0 comments on commit fd429e3

Please sign in to comment.