From a7908c1f1107c2b580e5e404e5babdf643e305c7 Mon Sep 17 00:00:00 2001 From: Tony Hu Date: Tue, 20 Mar 2018 15:41:40 -0700 Subject: [PATCH] [java] Change classpath logic to handle paths relative to project root Summary: For classpath computation, assume relative paths are relative to project root. Reviewed By: jeremydubreil Differential Revision: D7331496 fbshipit-source-id: e1bddc8 --- infer/src/java/jClasspath.ml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/infer/src/java/jClasspath.ml b/infer/src/java/jClasspath.ml index c1359e5d8..927b62a88 100644 --- a/infer/src/java/jClasspath.ml +++ b/infer/src/java/jClasspath.ml @@ -45,11 +45,12 @@ let is_model procname = String.Set.mem !models_specs_filenames (Typ.Procname.to_ let split_classpath cp = Str.split (Str.regexp JFile.sep) cp let append_path classpath path = - if Sys.file_exists path = `Yes then - let root = Unix.getcwd () in - let full_path = Utils.filename_to_absolute ~root path in + let full_path = Utils.filename_to_absolute ~root:Config.project_root path in + if Sys.file_exists full_path = `Yes then if Int.equal (String.length classpath) 0 then full_path else classpath ^ JFile.sep ^ full_path - else classpath + else ( + L.debug Capture Medium "Path %s not found" full_path ; + classpath ) type file_entry = Singleton of SourceFile.t | Duplicate of (string * SourceFile.t) list