diff --git a/src/with-dkml/cmdline.ml b/src/with-dkml/cmdline.ml index ffb2926..597c913 100644 --- a/src/with-dkml/cmdline.ml +++ b/src/with-dkml/cmdline.ml @@ -142,10 +142,10 @@ let when_path_exists_set_env ~envvar path = let set_precompiled_env abs_cmd_p = let ( let* ) = Rresult.R.( >>= ) in - (* Installation prefix *) - let prefix_p = Fpath.(parent (parent abs_cmd_p)) in + (* Installation prefix. Example: /usr/bin/utop -> *) + let prefix_p = Fpath.(abs_cmd_p |> parent |> parent |> parent) in let bc_p = Fpath.(prefix_p / "desktop" / "bc") in - let bc_bin_p = Fpath.(bc_p / "bin") in + let bc_usr_bin_p = Fpath.(bc_p / "usr" / "bin") in let bc_ocaml_lib_p = Fpath.(bc_p / "lib" / "ocaml") in let bc_ocaml_stublibs_p = Fpath.(bc_ocaml_lib_p / "stublibs") in let bc_stublibs_p = Fpath.(bc_p / "lib" / "stublibs") in @@ -187,7 +187,9 @@ let set_precompiled_env abs_cmd_p = in (* Dune requires ocamlc in the PATH. It should already be present but just in case put the bytecode executables in the PATH *) - let* () = when_dir_exists_prepend_pathlike_env ~envvar:"PATH" bc_bin_p in + let* () = + when_dir_exists_prepend_pathlike_env ~envvar:"PATH" bc_usr_bin_p + in Ok () | _ -> (* In an Opam switch diff --git a/src/with-dkml/with_dkml.ml b/src/with-dkml/with_dkml.ml index 63dccae..67201b1 100644 --- a/src/with-dkml/with_dkml.ml +++ b/src/with-dkml/with_dkml.ml @@ -286,7 +286,14 @@ let set_msvc_entries cache_keys = let dash = Fpath.(msys2_dir / "usr" / "bin" / "dash.exe" |> to_string) in - let cmd = Cmd.(v dash % Fpath.to_string tmp_sh_file) in + let extra_options = + match Logs.level () with + | Some Debug -> Cmd.(v "-x") + | _ -> Cmd.empty + in + let cmd = + Cmd.(v dash %% extra_options % Fpath.to_string tmp_sh_file) + in (OS.Cmd.run_status cmd >>= function | `Exited status -> if status <> 0 then