summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2015-01-16 22:45:06 +0000
committerDamien Doligez <damien.doligez-inria.fr>2015-01-16 22:45:06 +0000
commit0296d022e125cd7eef4a79011b88f180104d2948 (patch)
treec3d4ddfb2d9b9e114a19530dfc18e5a997cabb53 /driver
parent19801cfea7ae1f3f5412fa5b23d06b6a09323c9f (diff)
downloadocaml-0296d022e125cd7eef4a79011b88f180104d2948.tar.gz
PR#6081: ocaml should add script's directory to search path, not current directory
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15779 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'driver')
-rw-r--r--driver/compmisc.ml6
-rw-r--r--driver/compmisc.mli2
2 files changed, 4 insertions, 4 deletions
diff --git a/driver/compmisc.ml b/driver/compmisc.ml
index a2bc4b83a5..608683bbca 100644
--- a/driver/compmisc.ml
+++ b/driver/compmisc.ml
@@ -13,12 +13,12 @@
open Compenv
(* Initialize the search path.
- The current directory is always searched first,
+ [dir] is always searched first (default: the current directory),
then the directories specified with the -I option (in command-line order),
then the standard library directory (unless the -nostdlib option is given).
*)
-let init_path native =
+let init_path ?(dir="") native =
let dirs =
if !Clflags.use_threads then "+threads" :: !Clflags.include_dirs
else if !Clflags.use_vmthreads && not native then
@@ -30,7 +30,7 @@ let init_path native =
in
let exp_dirs =
List.map (Misc.expand_directory Config.standard_library) dirs in
- Config.load_path := "" ::
+ Config.load_path := dir ::
List.rev_append exp_dirs (Clflags.std_include_dir ());
Env.reset_cache ()
diff --git a/driver/compmisc.mli b/driver/compmisc.mli
index 032e9fe4aa..3087d544d2 100644
--- a/driver/compmisc.mli
+++ b/driver/compmisc.mli
@@ -10,5 +10,5 @@
(* *)
(***********************************************************************)
-val init_path : bool -> unit
+val init_path : ?dir:string -> bool -> unit
val initial_env : unit -> Env.t