mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Clerk: allow to include non-yet-existing directories
Useful when you have wide `-I` options that not all targets may depend on.
This commit is contained in:
parent
a988ad473b
commit
5b1462d529
@ -53,7 +53,7 @@ module Cli = struct
|
|||||||
let include_dirs =
|
let include_dirs =
|
||||||
Arg.(
|
Arg.(
|
||||||
value
|
value
|
||||||
& opt_all dir []
|
& opt_all string []
|
||||||
& info ["I"; "include"] ~docv:"DIR"
|
& info ["I"; "include"] ~docv:"DIR"
|
||||||
~doc:
|
~doc:
|
||||||
"Make modules from the given directory available from everywhere.")
|
"Make modules from the given directory available from everywhere.")
|
||||||
|
@ -213,14 +213,15 @@ module Tree = struct
|
|||||||
|
|
||||||
let rec build path =
|
let rec build path =
|
||||||
lazy
|
lazy
|
||||||
(Array.fold_left
|
(let entries = try Sys.readdir path with Sys_error _ -> [||] in
|
||||||
|
Array.fold_left
|
||||||
(fun m f ->
|
(fun m f ->
|
||||||
let path = path / f in
|
let path = path / f in
|
||||||
match Sys.is_directory path with
|
match Sys.is_directory path with
|
||||||
| true -> Map.add f (path, D (build path)) m
|
| true -> Map.add f (path, D (build path)) m
|
||||||
| false -> Map.add f (path, F) m
|
| false -> Map.add f (path, F) m
|
||||||
| exception Sys_error _ -> m)
|
| exception Sys_error _ -> m)
|
||||||
Map.empty (Sys.readdir path))
|
Map.empty entries)
|
||||||
|
|
||||||
let subtree t path =
|
let subtree t path =
|
||||||
let rec aux t = function
|
let rec aux t = function
|
||||||
|
Loading…
Reference in New Issue
Block a user