Skip to content

Commit

Permalink
stateConfig: add original_root_dir to store non redirected root dir
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou authored and dra27 committed Jun 10, 2024
1 parent 51b62da commit b38e02b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/client/opamClientConfig.mli
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ val opam_init:
?assume_depexts:bool ->
?cli:OpamCLIVersion.t ->
?scrubbed_environment_variables:string list ->
?original_root_dir:OpamTypes.dirname ->
?current_switch:OpamSwitch.t ->
?switch_from:OpamStateTypes.provenance ->
?jobs:int Lazy.t ->
Expand Down
6 changes: 6 additions & 0 deletions src/state/opamStateConfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ end

type t = {
root_dir: OpamFilename.Dir.t;
original_root_dir: OpamFilename.Dir.t;
current_switch: OpamSwitch.t option;
switch_from: provenance;
jobs: int Lazy.t;
Expand Down Expand Up @@ -86,6 +87,7 @@ let default = {
in
concat_and_resolve local_appdata "opam"
);
original_root_dir = default_root ();
current_switch = None;
switch_from = `Default;
jobs = lazy (max 1 (OpamSysPoll.cores () - 1));
Expand All @@ -108,6 +110,7 @@ let default = {

type 'a options_fun =
?root_dir:OpamFilename.Dir.t ->
?original_root_dir:OpamFilename.Dir.t ->
?current_switch:OpamSwitch.t ->
?switch_from:provenance ->
?jobs:(int Lazy.t) ->
Expand All @@ -126,6 +129,7 @@ type 'a options_fun =

let setk k t
?root_dir
?original_root_dir
?current_switch
?switch_from
?jobs
Expand All @@ -144,6 +148,7 @@ let setk k t
let (+) x opt = match opt with Some x -> x | None -> x in
k {
root_dir = t.root_dir + root_dir;
original_root_dir = t.original_root_dir + original_root_dir;
current_switch =
(match current_switch with None -> t.current_switch | s -> s);
switch_from = t.switch_from + switch_from;
Expand Down Expand Up @@ -176,6 +181,7 @@ let initk k =
in
setk (setk (fun c -> r := c; k)) !r
?root_dir:(E.root () >>| OpamFilename.Dir.of_string)
?original_root_dir:(E.root () >>| OpamFilename.Dir.of_string)
?current_switch
?switch_from
?jobs:(E.jobs () >>| fun s -> lazy s)
Expand Down
2 changes: 2 additions & 0 deletions src/state/opamStateConfig.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ end

type t = private {
root_dir: OpamFilename.Dir.t;
original_root_dir: OpamFilename.Dir.t;
current_switch: OpamSwitch.t option;
switch_from: provenance;
jobs: int Lazy.t;
Expand All @@ -56,6 +57,7 @@ type t = private {

type 'a options_fun =
?root_dir:OpamFilename.Dir.t ->
?original_root_dir:OpamFilename.Dir.t ->
?current_switch:OpamSwitch.t ->
?switch_from:provenance ->
?jobs:(int Lazy.t) ->
Expand Down

0 comments on commit b38e02b

Please sign in to comment.