# # patch "main.ml" # from [f26ef48aa5ed050e2c8876afa3937dfadd7b0dd7] # to [3feaecce13b222addbbf8fd459a0738d7e2c36b0] # --- main.ml +++ main.ml @@ -14,9 +14,23 @@ (Lexing.from_string (String.sub s 1 (len - 1))) else s +let find_MT_dir () = + let rec up = function + | "/" -> raise Not_found + | p -> + let d = Filename.dirname p in + let m = Filename.concat d "MT" in + if Sys.file_exists m + then m + else up d in + if Sys.file_exists "MT" + then "MT" + else up (Sys.getcwd ()) + let parse_MT_options () = - let mt_options = Filename.concat "MT" "options" in - match try with_file_in input_lines mt_options with Sys_error _ -> [] with + match + try with_file_in input_lines (Filename.concat (find_MT_dir ()) "options") + with Not_found | Sys_error _ -> [] with | [] -> MTopt_none | lines -> let options =