summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asmcomp/compilenv.ml2
-rwxr-xr-xboot/ocamlcbin847848 -> 850764 bytes
-rw-r--r--debugger/source.ml2
-rw-r--r--tools/ocamldep.ml5
-rw-r--r--utils/misc.ml12
-rw-r--r--utils/misc.mli4
6 files changed, 20 insertions, 5 deletions
diff --git a/asmcomp/compilenv.ml b/asmcomp/compilenv.ml
index 0012cea4e..f5fb00453 100644
--- a/asmcomp/compilenv.ml
+++ b/asmcomp/compilenv.ml
@@ -112,7 +112,7 @@ let global_approx global_ident =
let (approx, crc) =
try
let filename =
- find_in_path !load_path (String.uncapitalize modname ^ ".cmx") in
+ find_in_path_uncap !load_path (modname ^ ".cmx") in
let (ui, crc) = read_unit_info filename in
if ui.ui_name <> modname then
raise(Error(Illegal_renaming(ui.ui_name, filename)));
diff --git a/boot/ocamlc b/boot/ocamlc
index ed3f57331..171175409 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/debugger/source.ml b/debugger/source.ml
index 553a85fce..f937c782a 100644
--- a/debugger/source.ml
+++ b/debugger/source.ml
@@ -21,7 +21,7 @@ open Primitives
(*** Conversion function. ***)
let source_of_module mdle =
- find_in_path !Config.load_path (String.uncapitalize mdle ^ ".ml")
+ find_in_path_uncap !Config.load_path (mdle ^ ".ml")
(*** Buffer cache ***)
diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml
index a1ab4786b..8e62e79b9 100644
--- a/tools/ocamldep.ml
+++ b/tools/ocamldep.ml
@@ -25,9 +25,8 @@ let load_path = ref [""]
let native_only = ref false
let find_dependency modname (byt_deps, opt_deps) =
- let name = String.uncapitalize modname in
try
- let filename = Misc.find_in_path !load_path (name ^ ".mli") in
+ let filename = Misc.find_in_path_uncap !load_path (modname ^ ".mli") in
let basename = Filename.chop_suffix filename ".mli" in
((basename ^ ".cmi") :: byt_deps,
(if Sys.file_exists (basename ^ ".ml")
@@ -35,7 +34,7 @@ let find_dependency modname (byt_deps, opt_deps) =
else basename ^ ".cmi") :: opt_deps)
with Not_found ->
try
- let filename = Misc.find_in_path !load_path (name ^ ".ml") in
+ let filename = Misc.find_in_path_uncap !load_path (modname ^ ".ml") in
let basename = Filename.chop_suffix filename ".ml" in
((basename ^ (if !native_only then ".cmx" else ".cmo")) :: byt_deps,
(basename ^ ".cmx") :: opt_deps)
diff --git a/utils/misc.ml b/utils/misc.ml
index 4841b7183..71998ac0d 100644
--- a/utils/misc.ml
+++ b/utils/misc.ml
@@ -75,6 +75,18 @@ let find_in_path path name =
in try_dir path
end
+let find_in_path_uncap path name =
+ let uname = String.uncapitalize name in
+ let rec try_dir = function
+ [] -> raise Not_found
+ | dir::rem ->
+ let fullname = Filename.concat dir name in
+ let ufullname = Filename.concat dir uname in
+ if Sys.file_exists fullname then fullname
+ else if Sys.file_exists ufullname then ufullname
+ else try_dir rem
+ in try_dir path
+
let remove_file filename =
try
Sys.remove filename
diff --git a/utils/misc.mli b/utils/misc.mli
index 3242a992d..4374edfe0 100644
--- a/utils/misc.mli
+++ b/utils/misc.mli
@@ -39,6 +39,10 @@ val may_map: ('a -> 'b) -> 'a option -> 'b option
val find_in_path: string list -> string -> string
(* Search a file in a list of directories. *)
+val find_in_path_uncap: string list -> string -> string
+ (* Same, but search also for uncapitalized name, i.e.
+ if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml
+ to match. *)
val remove_file: string -> unit
(* Delete the given file if it exists. Never raise an error. *)
val expand_directory: string -> string -> string