From 97bc95e8c920196d91a9d48cb4ac93f6c43b8187 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Fri, 25 Mar 2016 13:52:54 -0700 Subject: [PATCH] Allow relative or absolute names in ondemand_file Summary:public Allow the value of the INFER_ONDEMAND_FILE environment variable to be either an absolute path, or relative to the project root. Likewise, allow the entries in the file determined by INFER_ONDEMAND_FILE to be either absolute or relative to the project root. Note, however, that if they are absolute but not under the project root, they will not be found. Reviewed By: cristianoc Differential Revision: D3098489 fb-gh-sync-id: e861300 fbshipit-source-id: e861300 --- infer/src/backend/ondemand.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/infer/src/backend/ondemand.ml b/infer/src/backend/ondemand.ml index 112861157..34e726095 100644 --- a/infer/src/backend/ondemand.ml +++ b/infer/src/backend/ondemand.ml @@ -23,14 +23,15 @@ let read_dirs_to_analyze () = | None -> None | Some fname -> - read_file fname in + read_file (DB.source_file_to_abs_path (DB.source_file_from_string fname)) in match lines_opt with | None -> None | Some lines -> let res = ref StringSet.empty in let do_line line = - let source_dir = DB.source_dir_from_source_file (DB.source_file_from_string line) in + let rel_file = DB.source_file_to_rel_path (DB.source_file_from_string line) in + let source_dir = DB.source_dir_from_source_file (DB.source_file_from_string rel_file) in res := StringSet.add (DB.source_dir_to_string source_dir) !res in IList.iter do_line lines; Some !res