Skip to content

Commit

Permalink
Don't error if the external dir already exists
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
  • Loading branch information
rgrinberg committed May 15, 2019
1 parent 9e070f2 commit 12a7489
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/build_system.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@ end = struct
Sync
(Some Path.mkdir_p)

let exists =
Memo.create
"mkdir_p"
~doc:"mkdir_p"
~input:(module Path)
~output:(Simple (module Bool))
~visibility:Hidden
Sync
(Some Path.exists)

let exec p =
if Path.is_managed p then
Memo.exec def p
else if Memo.exec exists p then
()
else
Exn.code_error "Mkdir_p.exec: attempted to create unmanaged dir"
[ "p", Path.to_sexp p
Expand Down
2 changes: 2 additions & 0 deletions src/stdune/bool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ include Comparable.Operators(struct
let to_string = string_of_bool

let of_string s = Option.try_with (fun () -> bool_of_string s)

let to_sexp t = Sexp0.Atom (to_string t)
2 changes: 2 additions & 0 deletions src/stdune/bool.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ include Comparable.OPS with type t := t
val to_string : t -> string

val of_string : string -> t option

val to_sexp : t -> Sexp0.t

0 comments on commit 12a7489

Please sign in to comment.