summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorJeremie Dimino <jeremie@dimino.org>2018-09-18 14:49:18 +0100
committerDavid Allsopp <david.allsopp@metastack.com>2019-01-30 16:36:38 +0000
commit7e0862a21290ba9462ef3bd7f82fc6835b25852b (patch)
tree0e797bb88543b939eaf3fa2ecebabf65143db544 /driver
parent295684568142aa3df72075346d8c9b306e43a1e0 (diff)
downloadocaml-7e0862a21290ba9462ef3bd7f82fc6835b25852b.tar.gz
Refactor load path management and initial environment
- Add a Load_path module which caches files lookup - Instead of falling back to the external environment, allow to declare in the environment that a module comes from the external world. This allows persistent structures to shadows non-persistent ones
Diffstat (limited to 'driver')
-rw-r--r--driver/compmisc.ml3
-rw-r--r--driver/compplugin.ml2
2 files changed, 2 insertions, 3 deletions
diff --git a/driver/compmisc.ml b/driver/compmisc.ml
index 8f728e292f..7cf81f2e2f 100644
--- a/driver/compmisc.ml
+++ b/driver/compmisc.ml
@@ -34,8 +34,7 @@ let init_path ?(dir="") native =
in
let exp_dirs =
List.map (Misc.expand_directory Config.standard_library) dirs in
- Config.load_path := dir ::
- List.rev_append exp_dirs (Clflags.std_include_dir ());
+ Load_path.init (dir :: List.rev_append exp_dirs (Clflags.std_include_dir ()));
Env.reset_cache ()
(* Return the initial environment in which compilation proceeds. *)
diff --git a/driver/compplugin.ml b/driver/compplugin.ml
index 42f3177413..ad29cc9158 100644
--- a/driver/compplugin.ml
+++ b/driver/compplugin.ml
@@ -28,7 +28,7 @@ let load plugin_name =
if Filename.is_implicit plugin_name then
try
Compmisc.init_path !Clflags.native_code;
- Misc.find_in_path !Config.load_path plugin_name
+ Load_path.find plugin_name
with Not_found ->
failwith (Printf.sprintf "Cannot find plugin %s in load path"
plugin_name)