aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2015-09-25 14:19:25 +0200
committerPierre-Marie Pédrot2015-09-25 14:19:25 +0200
commitccd23fa241ab11477b2fec48ba5262206a1134d5 (patch)
treed864a4ad99f869b03c2c08650029e03fa1400c32 /lib
parent8a031dc29abf1e16b2ee78322a7221b8b5c19a33 (diff)
parent8e25e107a8715728a7227934d7b11035863ee5f0 (diff)
Merge branch 'v8.5'
Diffstat (limited to 'lib')
-rw-r--r--lib/envars.ml19
-rw-r--r--lib/system.ml16
-rw-r--r--lib/system.mli2
3 files changed, 5 insertions, 32 deletions
diff --git a/lib/envars.ml b/lib/envars.ml
index 315d28cebd..bafe2401bb 100644
--- a/lib/envars.ml
+++ b/lib/envars.ml
@@ -39,25 +39,12 @@ let path_to_list p =
let user_path () =
path_to_list (Sys.getenv "PATH") (* may raise Not_found *)
- (* Duplicated from system.ml to minimize dependencies *)
-let file_exists_respecting_case f =
- if Coq_config.arch = "Darwin" then
- (* ensure that the file exists with expected case on the
- case-insensitive but case-preserving default MacOS file system *)
- let rec aux f =
- let bf = Filename.basename f in
- let df = Filename.dirname f in
- String.equal df "." || String.equal df "/" ||
- aux df && Array.exists (String.equal bf) (Sys.readdir df)
- in aux f
- else Sys.file_exists f
-
let rec which l f =
match l with
| [] ->
raise Not_found
| p :: tl ->
- if file_exists_respecting_case (p / f) then
+ if Sys.file_exists (p / f) then
p
else
which tl f
@@ -115,7 +102,7 @@ let _ =
If the check fails, then [oth ()] is evaluated. *)
let check_file_else ~dir ~file oth =
let path = if Coq_config.local then coqroot else coqroot / dir in
- if file_exists_respecting_case (path / file) then path else oth ()
+ if Sys.file_exists (path / file) then path else oth ()
let guess_coqlib fail =
let prelude = "theories/Init/Prelude.vo" in
@@ -147,7 +134,7 @@ let coqpath =
let coqpath = getenv_else "COQPATH" (fun () -> "") in
let make_search_path path =
let paths = path_to_list path in
- let valid_paths = List.filter file_exists_respecting_case paths in
+ let valid_paths = List.filter Sys.file_exists paths in
List.rev valid_paths
in
make_search_path coqpath
diff --git a/lib/system.ml b/lib/system.ml
index 26bf780101..e4a60eccb7 100644
--- a/lib/system.ml
+++ b/lib/system.ml
@@ -94,18 +94,6 @@ let all_subdirs ~unix_path:root =
else msg_warning (str ("Cannot open " ^ root));
List.rev !l
-let file_exists_respecting_case f =
- if Coq_config.arch = "Darwin" then
- (* ensure that the file exists with expected case on the
- case-insensitive but case-preserving default MacOS file system *)
- let rec aux f =
- let bf = Filename.basename f in
- let df = Filename.dirname f in
- (String.equal df "." || String.equal df "/" || aux df)
- && Array.exists (String.equal bf) (Sys.readdir df)
- in aux f
- else Sys.file_exists f
-
let rec search paths test =
match paths with
| [] -> []
@@ -130,7 +118,7 @@ let where_in_path ?(warn=true) path filename =
in
check_and_warn (search path (fun lpe ->
let f = Filename.concat lpe filename in
- if file_exists_respecting_case f then [lpe,f] else []))
+ if Sys.file_exists f then [lpe,f] else []))
let where_in_path_rex path rex =
search path (fun lpe ->
@@ -146,7 +134,7 @@ let where_in_path_rex path rex =
let find_file_in_path ?(warn=true) paths filename =
if not (Filename.is_implicit filename) then
- if file_exists_respecting_case filename then
+ if Sys.file_exists filename then
let root = Filename.dirname filename in
root, filename
else
diff --git a/lib/system.mli b/lib/system.mli
index eb29b69701..6ed4503266 100644
--- a/lib/system.mli
+++ b/lib/system.mli
@@ -59,8 +59,6 @@ val where_in_path_rex :
val find_file_in_path :
?warn:bool -> CUnix.load_path -> string -> CUnix.physical_path * string
-val file_exists_respecting_case : string -> bool
-
(** {6 I/O functions } *)
(** Generic input and output functions, parameterized by a magic number
and a suffix. The intern functions raise the exception [Bad_magic_number]