From 928bba989605ce5cad12435acbc2810c841a0a3f Mon Sep 17 00:00:00 2001 From: ZAN DoYe Date: Thu, 23 May 2019 20:37:56 +0800 Subject: [PATCH] add get_load_path and set_load_path --- src/lib/uTop.ml | 12 ++++++++++++ src/lib/uTop.mli | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/src/lib/uTop.ml b/src/lib/uTop.ml index f10831d..f7e9b46 100644 --- a/src/lib/uTop.ml +++ b/src/lib/uTop.ml @@ -811,6 +811,18 @@ let () = (* Make UTop accessible. *) 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 | +-----------------------------------------------------------------+ *) diff --git a/src/lib/uTop.mli b/src/lib/uTop.mli index 86c1119..93ca7fe 100644 --- a/src/lib/uTop.mli +++ b/src/lib/uTop.mli @@ -356,6 +356,15 @@ val discard_formatters : Format.formatter list -> (unit -> 'a) -> 'a 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: *)