From 4b5af0d6e9ec1343a2c3ff9f856a019fa93c3606 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Fri, 15 May 2015 17:42:16 +0200 Subject: On MacOS X, ensuring that files found in the file system have the expected lowercase/uppercase spelling (based on a patch by Pierre B.). This should fix #2554 (and see also discussion on coq-club, May 2015). --- lib/system.ml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/system.ml') diff --git a/lib/system.ml b/lib/system.ml index d1cdd8efc..6364035e1 100644 --- a/lib/system.ml +++ b/lib/system.ml @@ -53,6 +53,19 @@ let all_subdirs ~unix_path:root = if exists_dir root then traverse root []; List.rev !l +let file_really_exists 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 = + Printf.eprintf ".%!"; + 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 | [] -> [] -- cgit v1.2.3