[cli] create missing directory

Summary:
The captured/ directory is not guaranteed to exist when the capture was run without debug mode, but the analysis assumes it will be. So, this crashes infer:

```
infer -- clang -c examples/hello.c
infer -g
```

There's no need for `DB.Results_dir.init` to create infer-out and infer-out/specs/ since this is now done in `ResultsDir`.

Reviewed By: jeremydubreil

Differential Revision: D8732739

fbshipit-source-id: aaac902
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 129cadb9b6
commit a5a106c83a

@ -19,6 +19,7 @@ let clear_caches () =
(** Create tasks to analyze an execution environment *) (** Create tasks to analyze an execution environment *)
let analyze_source_file : SourceFile.t Tasks.doer = let analyze_source_file : SourceFile.t Tasks.doer =
fun source_file -> fun source_file ->
DB.Results_dir.init source_file ;
let exe_env = Exe_env.mk () in let exe_env = Exe_env.mk () in
L.(debug Analysis Medium) "@\nProcessing '%a'@." SourceFile.pp source_file ; L.(debug Analysis Medium) "@\nProcessing '%a'@." SourceFile.pp source_file ;
(* clear cache for each source file to avoid it growing unboundedly *) (* clear cache for each source file to avoid it growing unboundedly *)

@ -180,8 +180,6 @@ module Results_dir = struct
(** initialize the results directory *) (** initialize the results directory *)
let init source = let init source =
if SourceFile.is_invalid source then L.(die InternalError) "Invalid source file passed" ; if SourceFile.is_invalid source then L.(die InternalError) "Invalid source file passed" ;
Utils.create_dir Config.results_dir ;
Utils.create_dir specs_dir ;
if Config.html || Config.debug_mode || Config.frontend_tests then ( if Config.html || Config.debug_mode || Config.frontend_tests then (
Utils.create_dir (path_to_filename Abs_root [Config.captured_dir_name]) ; Utils.create_dir (path_to_filename Abs_root [Config.captured_dir_name]) ;
Utils.create_dir (path_to_filename (Abs_source_dir source) []) ) Utils.create_dir (path_to_filename (Abs_source_dir source) []) )

Loading…
Cancel
Save