add get_load_path and set_load_path

This commit is contained in:
ZAN DoYe 2019-05-23 20:37:56 +08:00
parent 97224e635f
commit 928bba9896
2 changed files with 21 additions and 0 deletions

View File

@ -811,6 +811,18 @@ let () =
(* Make UTop accessible. *) (* Make UTop accessible. *)
Topdirs.dir_directory (Findlib.package_directory "utop") Topdirs.dir_directory (Findlib.package_directory "utop")
(* +-----------------------------------------------------------------+
| Compiler-libs re-exports |
+-----------------------------------------------------------------+ *)
#if OCAML_VERSION >= (4, 08, 0)
let get_load_path ()= Load_path.get_paths ()
let set_load_path path= Load_path.init path
#else
let get_load_path ()= !Config.load_path
let set_load_path path= Config.load_path := path
#endif
(* +-----------------------------------------------------------------+ (* +-----------------------------------------------------------------+
| Deprecated | | Deprecated |
+-----------------------------------------------------------------+ *) +-----------------------------------------------------------------+ *)

View File

@ -356,6 +356,15 @@ val discard_formatters : Format.formatter list -> (unit -> 'a) -> 'a
val split_words : string -> string list val split_words : string -> string list
(** {6 compiler-libs reexports} *)
val get_load_path : unit -> string list
val set_load_path : string list -> unit
(** [get_load_path] is an alias of [Config.load_path], normally hidden in toplevel.
[get_load_path] and [set_load_path] manage the include directories.
The internal variable contains the list of directories added by findlib-required packages
and [#directory] directives. *)
(**/**) (**/**)
(* These variables are not used and deprecated: *) (* These variables are not used and deprecated: *)