Skip to content

Commit

Permalink
Create directory for history file if directory does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Garth Tuohy committed Apr 4, 2024
1 parent edca64d commit 4654b22
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/uTop_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ let init_history () =
return ()
| Some fn ->
Lwt.catch
(fun () -> LTerm_history.load UTop.history fn)
(fun () ->
let dn = Filename.dirname fn in
if not (Sys.file_exists dn) then Unix.mkdir dn 0o700;
LTerm_history.load UTop.history fn)
(function
| Unix.Unix_error (error, func, arg) ->
Logs_lwt.err (fun m -> m "cannot load history from %S: %s: %s"
Expand Down

0 comments on commit 4654b22

Please sign in to comment.