Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct paths for utop-history, utoprc: in utop subdirs of XDG base dirs #484

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions src/lib/uTop_private.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ module Default_paths = struct
let history_file_name =
resolve
~legacy:(LTerm_resources.home / ".utop-history")
~filename:(Xdg.state_dir xdg / "utop-history")
~filename:(Xdg.state_dir xdg / "utop" / "utop-history")

let config_file_name =
resolve
~legacy:(LTerm_resources.home / ".utoprc")
~filename:(Xdg.config_dir xdg / "utoprc")
~filename:(Xdg.config_dir xdg / "utop" / "utoprc")
end

let size, set_size =
Expand Down