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

improve user-defined config file detection #311

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zapashcanon
Copy link
Member

Hi,

The idea behind this PR is to change the way the global user-defined configuration file path is chosen, to make it more standard and to follow the suitable conventions on all platforms. I used directories.

With this PR, the path is computed as follow:

  • on Linux, $XDG_CONFIG_HOME/ocp-indent/config with $XDG_CONFIG_HOME defaulting to $HOME/.config/
  • on macOS, $HOME/Library/Application Support/com.OCamlPro.ocp-indent/config
  • on Windows, {FOLDERID_ApplicationData}/OCamlPro/ocp-indent/config ; the path of {FOLDERID_ApplicationData} can be obtained only using SHGetKnownFolderPath

directories has no dependency, except on Windows where it depends on ctypes, it works on all OCaml version from 4.07, but I haven't tested older versions.

@nojb
Copy link
Contributor

nojb commented Nov 19, 2020

Please don't add external dependencies to ocp-indent if it can be helped at all. They complicate using it in non-opam situations.

@dbuenzli
Copy link
Contributor

  • on macOS, $HOME/Library/Application Support/com.OCamlPro.ocp-indent/config

Configurations for unix cli tool are perfectly fine according to xdg on macOS, for one thing that's where git puts its stuff and having it in .config makes it easy to sync over different unix machines.

I don't mind if you also want to too look there but please do not change the defaults as they are now.

@zapashcanon
Copy link
Member Author

having it in .config makes it easy to sync over different unix machines

You could still sync it and just do a one time command d="$HOME/Library/Application Support/com.OCamlPro.ocp-indent/" && mkdir -p "$d" && ln -s $HOME/.config/ocp-indent/ "$d".

@dbuenzli
Copy link
Contributor

and just do a one time command

I'd rather suggest not to try to "fix" things that are not broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants