Correct paths for utop-history, utoprc: in utop subdirs of XDG base dirs - #484
Merged
Conversation
Contributor
Author
|
Added check & creation of history file's parent directory, fixing #478 This was exacerbated with the first patch because XDG_STATE_HOME/utop was extremely unlikely to exist on any system |
|
I believe this should be the proper place since |
Member
|
I also agree that this is more standard location. I am planning to merge if there are no objections. |
Octachron
reviewed
Jun 26, 2025
| (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; |
Member
There was a problem hiding this comment.
Isn't 700 a bit strict for permissions on a directory? I would expect 755 (possibly lowered by the user umask)
Octachron
added a commit
to Octachron/opam-repository
that referenced
this pull request
Jul 25, 2025
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
Octachron
added a commit
to Octachron/opam-repository
that referenced
this pull request
Jul 25, 2025
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
Octachron
added a commit
to Octachron/opam-repository
that referenced
this pull request
Jul 25, 2025
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
Octachron
added a commit
to Octachron/opam-repository
that referenced
this pull request
Jul 25, 2025
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
Octachron
added a commit
to Octachron/opam-repository
that referenced
this pull request
Jul 25, 2025
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
Octachron
added a commit
to Octachron/opam-repository
that referenced
this pull request
Jul 25, 2025
CHANGES: * Add support for OCaml 5.4 (ocaml-community/utop#500, @Octachron, @anmonteiro) * restore backtrace (ocaml-community/utop#503, fixes ocaml-community/utop#501, @ysalmon) * support camlp$n preprocessor (ocaml-community/utop#486, fixes ocaml-community/utop#485, @aqjune) * utop configuration and state files (utoprc, utop-history) are now always in the relevant utop subdirectory (ocaml-community/utop#484, fixes ocaml-community/utop#478, ocaml-community/utop#481 and ocaml-community/utop#499, @tuohy). * fix emacs completion for qualified paths (Module.M.some_name) (ocaml-community/utop#497, fix ocaml-community/utop#455, @juergenhoetzel, @bbatsov) * implicit bindings for emacs mode (ocaml-community/utop#465, fix ocaml-community/utop#412, @bencef)
This was referenced Aug 8, 2025
Octachron
added a commit
that referenced
this pull request
Aug 12, 2025
fix utoprc templates to mention the correct path (changed by #484)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #481 described failure to load utoprc from its stated location
PR #475 misidentified the issue as an incorrect README
In fact the paths were pointing to files within the XDG base directories themselves rather than in a subdirectory for the utop application.
This patch simply changes $XDG_STATE_HOME/utop-history to $XDG_STATE_HOME/utop/utop-history and $XDG_CONFIG_HOME/utoprc to $XDG_CONFIG_HOME/utop/utoprc