camlspotter avatar camlspotter committed 3adae44 Merge

merge with default

Comments (0)

Files changed (2)

                 str
               with
               | e -> 
-                  eprintf "LOAD FAILIURE %s: %s@." (Ident.name id) (Printexc.to_string e);
+                  eprintf "LOAD FAILURE %s: %s@." (Ident.name id) (Printexc.to_string e);
                   Error e
               end
             else begin 
 
   and find_ident (str : Value.structure) (kind, name, pos) : Value.z =
     let name_filter = fun (id, (k,_)) -> 
+(*
       Debug.format "DEBUG: %s %s ? %s %s@."
         (Kind.to_string kind)
         name 
         (Kind.to_string k)
         (Ident0.name id);
+*)
       k = kind && Ident0.name id = name in
     (* CR jfuruse: double check by pos! *)
     lazy begin
 
   let check_time_stamp ~cmt source =
     let stat_cmt = Unix.stat cmt in
-    let stat_source = Unix.stat source in
-      (* Needs = : for packed modules, .cmt and the source .cmo are written 
-         almost at the same moment. *)
-    stat_cmt.Unix.st_mtime >= stat_source.Unix.st_mtime
+    try
+      let stat_source = Unix.stat source in
+        (* Needs = : for packed modules, .cmt and the source .cmo are written 
+           almost at the same moment. *)
+      stat_cmt.Unix.st_mtime >= stat_source.Unix.st_mtime
+    with
+    | Unix.Unix_error(_, "stat", _) ->
+        (* CR jfuruse: Camlp4.cmt created from Camlp4.cmx but Camlp4.cmx
+           is not installed!!! In such a case, we cannot check the time
+           stamp check... (still we can try against Camlp4.cmi installed)
+        *)
+        eprintf "Warning: source %s does not exist. Time stamp check was skipped.@." source;
+        true
 
   let find_alternative_source ~cmt source =
       (* if [source] is not found, we try finding files with the same basename
   let load_directly path : Unit.t =
     Debug.format "cmt loading from %s@." path;
     match load_cmt_file path with
-    | Some cmt -> Spot.Unit.of_file (Spot.File.of_cmt path cmt)
+    | Some cmt -> 
+        Spot.Unit.of_file (Spot.File.of_cmt path cmt)
     | None -> failwith (sprintf "load_directly failed: %s" path)
 
   exception Old_cmt of string (* cmt *) * string (* source *)
   let find_in_path load_paths body ext =
     let body_ext = body ^ ext in
     let find_in_path load_paths name = 
+      Debug.format "@[<2>searching %s in@ pwd=%s@ paths=[@[%a@]]@]@." 
+        name
+        (Sys.getcwd ())
+        (Format.list "; " (fun ppf x -> fprintf ppf "%S" x)) 
+        load_paths;
       try Misc.find_in_path load_paths name with Not_found ->
         Misc.find_in_path_uncap load_paths name
     in
     
 
   let load ~load_paths cmtname : Unit.t =
-    Debug.format "@[<2>cmt searching %s in@ paths [@[%a@]]@]@." 
-        cmtname
-        (Format.list "; " (fun ppf x -> fprintf ppf "%S" x)) 
-        load_paths;
     let body, ext = Filename.split_extension cmtname in
     let path = find_in_path load_paths body ext in
     load_directly_with_cache path
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.