diff --git a/src/state/opamEnv.ml b/src/state/opamEnv.ml index ea156a25aa4..bf722975f36 100644 --- a/src/state/opamEnv.ml +++ b/src/state/opamEnv.ml @@ -247,6 +247,13 @@ let get_opam_raw ?(set_opamroot=false) ?(set_opamswitch=false) ~force_path root switch = let env_file = OpamPath.Switch.environment root switch in let upd = OpamFile.Environment.safe_read env_file in + let upd = + ("OPAM_SWITCH_PREFIX", Eq, + OpamFilename.Dir.to_string (OpamPath.Switch.root root switch), + Some "Prefix of the current opam switch") :: + List.filter (function ("OPAM_SWITCH_PREFIX", Eq, _, _) -> false | _ -> true) + upd + in let upd = if force_path then List.map (function