Ver Fonte

separated get_full_path/get_real_path + only use get_real_path when necessary (slow)

Nicolas Cannasse há 13 anos atrás
pai
commit
b447193cb9
2 ficheiros alterados com 6 adições e 5 exclusões
  1. 2 2
      common.ml
  2. 4 3
      main.ml

+ 2 - 2
common.ml

@@ -232,7 +232,7 @@ let find_file ctx f =
 
 let get_full_path f = try Extc.get_full_path f with _ -> f
 
-let unique_full_path = get_full_path
+let unique_full_path = if Sys.os_type = "Win32" || Sys.os_type = "Cygwin" then (fun f -> String.lowercase (get_full_path f)) else get_full_path
 
 (* ------------------------- TIMERS ----------------------------- *)
 
@@ -242,7 +242,7 @@ type timer_infos = {
 	mutable total : float;
 }
 
-let get_time = Extc.cpu_time
+let get_time = Extc.time
 let htimers = Hashtbl.create 0
 
 let new_timer name =

+ 4 - 3
main.ml

@@ -247,7 +247,7 @@ let lookup_classes com spath =
 		| [] -> []
 		| cp :: l ->
 			let cp = (if cp = "" then "./" else cp) in
-			let c = normalize_path (Common.unique_full_path cp) in
+			let c =  Extc.get_real_path (Common.unique_full_path (normalize_path cp)) in
 			let clen = String.length c in
 			if clen < String.length spath && String.sub spath 0 clen = c then begin
 				let path = String.sub spath clen (String.length spath - clen) in
@@ -872,8 +872,9 @@ try
 		com.warning <- message ctx;
 		com.error <- error ctx;
 		com.main_class <- None;
-		classes := lookup_classes com (!Parser.resume_display).Ast.pfile;
-		Common.log com ("Display file : " ^ (!Parser.resume_display).Ast.pfile);
+		let real = Extc.get_real_path (!Parser.resume_display).Ast.pfile in
+		classes := lookup_classes com real;
+		Common.log com ("Display file : " ^ real);
 		Common.log com ("Classes found : ["  ^ (String.concat "," (List.map Ast.s_type_path !classes)) ^ "]");
 	end;
 	let add_std dir =