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-0dff7051ff02master
parent
19801cfea7
commit
0296d022e1
2
Changes
2
Changes
|
@ -61,6 +61,8 @@ Bug fixes:
|
|||
- PR#5887: move the byterun/*.h headers to byterun/caml/*.h to avoid header
|
||||
name clashes
|
||||
(Jérôme Vouillon and Adrien Nader and Peter Zotov)
|
||||
- PR#6081: ocaml should add script's directory to search path, not current directory
|
||||
(Thomas Leonard and Damien Doligez)
|
||||
- PR#6560: Wrong failure message for {Int32,Int64,NativeInt}.of_string
|
||||
(Maxime Dénès and Gabriel Scherer)
|
||||
- PR#6648: show_module should indicate its elision
|
||||
|
|
|
@ -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 ()
|
||||
|
||||
|
|
|
@ -10,5 +10,5 @@
|
|||
(* *)
|
||||
(***********************************************************************)
|
||||
|
||||
val init_path : bool -> unit
|
||||
val init_path : ?dir:string -> bool -> unit
|
||||
val initial_env : unit -> Env.t
|
||||
|
|
|
@ -451,7 +451,14 @@ let run_script ppf name args =
|
|||
Array.blit args 0 Sys.argv 0 len;
|
||||
Obj.truncate (Obj.repr Sys.argv) len;
|
||||
Arg.current := 0;
|
||||
Compmisc.init_path true;
|
||||
Compmisc.init_path ~dir:(Filename.dirname name) true;
|
||||
(* Note: would use [Filename.abspath] here, if we had it. *)
|
||||
toplevel_env := Compmisc.initial_env();
|
||||
Sys.interactive := false;
|
||||
use_silently ppf name
|
||||
let explicit_name =
|
||||
(* Prevent use_silently from searching in the path. *)
|
||||
if Filename.is_implicit name
|
||||
then Filename.concat Filename.current_dir_name name
|
||||
else name
|
||||
in
|
||||
use_silently ppf explicit_name
|
||||
|
|
|
@ -471,7 +471,14 @@ let run_script ppf name args =
|
|||
Array.blit args 0 Sys.argv 0 len;
|
||||
Obj.truncate (Obj.repr Sys.argv) len;
|
||||
Arg.current := 0;
|
||||
Compmisc.init_path false;
|
||||
Compmisc.init_path ~dir:(Filename.dirname name) true;
|
||||
(* Note: would use [Filename.abspath] here, if we had it. *)
|
||||
toplevel_env := Compmisc.initial_env();
|
||||
Sys.interactive := false;
|
||||
use_silently ppf name
|
||||
let explicit_name =
|
||||
(* Prevent use_silently from searching in the path. *)
|
||||
if Filename.is_implicit name
|
||||
then Filename.concat Filename.current_dir_name name
|
||||
else name
|
||||
in
|
||||
use_silently ppf explicit_name
|
||||
|
|
Loading…
Reference in New Issue