Skip to content

Commit

Permalink
handle dir already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
edchapman88 committed Oct 24, 2024
1 parent cc58cd4 commit 76e376c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/log.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
let file_of_path (path : string) =
let path = if String.ends_with ~suffix:"/" path then path else path ^ "/" in
(* Read and write for all users.*)
Unix.mkdir path 0o777;
(try (* Read and write for all users.*)
Unix.mkdir path 0o777
with Unix.Unix_error (Unix.EEXIST, _, _) -> ());
let open Core.Time_float in
open_out (path ^ to_filename_string ~zone:Zone.utc (now ()) ^ ".txt")

Expand Down

0 comments on commit 76e376c

Please sign in to comment.