Skip to content

Commit

Permalink
TOSQUASH: add readme.txt in redirected opamroot
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Jun 5, 2024
1 parent b24a44f commit 005211c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ let init
shell =
log "INIT %a"
(slog @@ OpamStd.Option.to_string OpamRepositoryBackend.to_string) repo;
let root =
let root, redirected =
let root = OpamStateConfig.(!r.root_dir) in
let has_space s = OpamStd.String.contains_char s ' ' in
if Sys.win32 &&
Expand Down Expand Up @@ -1171,8 +1171,8 @@ let init
let new_root = OpamFilename.Dir.of_string new_root_f in
OpamFilename.write (OpamPath.redirected root) new_root_f;
OpamStateConfig.update ~root_dir:new_root ();
new_root)
else root
new_root, true)
else root, false
in
let config_f = OpamPath.config root in
let root_empty =
Expand All @@ -1193,6 +1193,12 @@ let init
(OpamFilename.Dir.to_string root);
if not (OpamConsole.confirm "Proceed?") then
OpamStd.Sys.exit_because `Aborted);
(* Add the readme file in C:\opamroot as redirected *)
(if Sys.win32 && redirected then
OpamFilename.write
OpamFilename.Op.(root // "readme.txt")
(Printf.sprintf "Opam root redirected from %s"
(OpamFilename.Dir.to_string OpamStateConfig.(!r.root_dir)));
try
(* Create the content of ~/.opam/config *)
let repos = match repo with
Expand Down

0 comments on commit 005211c

Please sign in to comment.