diff options
author | Son Ho | 2022-03-04 00:02:08 +0100 |
---|---|---|
committer | Son Ho | 2022-03-04 00:02:08 +0100 |
commit | f12c94e6a8665aa9a7a4572dd65ece4064007f1c (patch) | |
tree | e4fecba87b4e0d40e2969befab10d24186c7ad1f | |
parent | 60a39d180cd7cbf525e8d9f0bd2d5c7855fc73b9 (diff) |
Update the code to create missing directories upon export
-rw-r--r-- | src/Translate.ml | 6 | ||||
-rw-r--r-- | src/dune | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/Translate.ml b/src/Translate.ml index 1a42892d..5812dc89 100644 --- a/src/Translate.ml +++ b/src/Translate.ml @@ -639,6 +639,12 @@ let translate_module (filename : string) (dest_dir : string) (config : config) } in + (* Create the directory, if necessary *) + if not (Sys.file_exists dest_dir) then ( + log#linfo (lazy ("Creating missing directory: " ^ dest_dir)); + (* Create a directory with *default* permissions *) + Core.Unix.mkdir_p dest_dir); + (* Extract one or several files, depending on the configuration *) if config.split_files then ( let base_gen_config = @@ -1,7 +1,8 @@ +;; core: for Core.Unix.mkdir_p (executable (name main) (preprocess (pps ppx_deriving.show ppx_deriving.ord visitors.ppx)) - (libraries ppx_deriving yojson zarith easy_logging)) + (libraries ppx_deriving yojson zarith easy_logging core)) (env (dev (flags |