OCamlPro / directories

directories is an OCaml library that provides configuration, cache and data paths (and more!) following the suitable conventions on Linux, macOS and Windows. The following conventions are used: XDG Base Directory Specification and xdg-user-dirs on Linux, Known Folders on Windows, Standard Directories on macOS.
ISC License
34 stars 3 forks source link

Windows config_dir #15

Open jonahbeckford opened 1 year ago

jonahbeckford commented 1 year ago

Is there any reason that the Roaming %AppData% is chosen as the config_dir in the following https://github.com/OCamlPro/directories/blob/1cf7211f918fa909e5f77c0dfbb059c74071e99b/src/windows/directories.ml#L36-L37

I've commonly seen XDG_CONFIG_HOME mapped to %LocalAppData%, like in https://docs.racket-lang.org/basedir/index.html . Either way makes sense (I'm not objecting), but since I'm evaluating making this package the standard for the DkML Windows distribution (once #14 is addressed) I'd love to understand.

jonahbeckford commented 1 year ago

Forgot that the other active XDG library (https://v3.ocaml.org/p/xdg/latest) uses LocalAppData in https://github.com/ocaml/dune/blob/8f7bcffb1f797bf2d240430d1be09be462654857/otherlibs/xdg/xdg.ml#L38-L40 :

let config_dir t =
  let home = t.home_dir in
  make t "XDG_CONFIG_HOME" (home / ".config") LocalAppData

So it would be good to harmonize!

zapashcanon commented 1 year ago

Hi @jonahbeckford

IIRC, I followed what was done in directories-rs and directories-jvm.

It seems a config_local_dir was recently added to directories-rs.

I'm not sure which (roaming/local) is best for the default config dir but I would say roaming as it's usually files one would want to keep in sync (at least that's what I usually do personally on linux: my dotfiles are all sync'ed).

I'm not against doing the same thing as in directories-rs (i.e. adding a local config dir, and having it to point to config_dir on linux/macOS). If you're interested enough to do a PR, I'll merge it. ;)

jonahbeckford commented 1 year ago

Oh config_local_dir would be good. When I swing back this way (it will be a while) I'll look at doing a PR.