From d07c4511b87a8b3949c26ab7bf7c21b8ee57f475 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 28 Feb 2023 19:23:02 -0600 Subject: [PATCH] fix: custom log file path Create directory when using a custom path for the log file Signed-off-by: Rudi Grinberg --- src/dune_util/log.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dune_util/log.ml b/src/dune_util/log.ml index b45c80b21fd..4c5798d323a 100644 --- a/src/dune_util/log.ml +++ b/src/dune_util/log.ml @@ -20,7 +20,9 @@ let init ?(file = File.Default) () = match file with | No_log_file -> None | Out_channel s -> Some s - | This path -> Some (Io.open_out path) + | This path -> + Path.mkdir_p (Path.parent_exn path); + Some (Io.open_out path) | Default -> Path.ensure_build_dir_exists (); Some (Io.open_out (Path.relative Path.build_dir "log"))