jorgebucaran / nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
https://git.io/nvm.fish
MIT License
2.13k stars 71 forks source link

Migrate nvm dir from XDG_CONFIG_HOME to XDG_DATA_HOME #108

Closed thernstig closed 3 years ago

thernstig commented 4 years ago

To show case what I mean, I am going to paste the information another tool called direnv does in a recent release:

Migrating the allow data to the new location

The allowed .envrc permissions used to be stored in the XDG_CONFIG_HOME. It's better to keep that folder for user-editable configuration so the data is being moved to XDG_DATA_HOME.

moving /home/userA/.config/direnv/allow to /home/userA/.local/share/direnv/allow creating a symlink back from /home/userA/.local/share/direnv/allow to /home/userA/.config/direnv/allow for back-compat.

All done, have a nice day!

As such, it would make sense for nvm to also migrate from XDG_CONFIG_HOME to XDG_DATA_HOME. The config is used for user-editable config whereas the data dir should be used for data written by the program such as nvm.

One of many reasons to do this is that a lot of users utilize dotfile support to backup configuration data, and that is often done for the XDG_CONFIG_HOME dir. Since nvm downloads binaries, it would mean many users might commit binaries to their git repo if they do not take care. Users do not expect the config dir to contain binaries.

jorgebucaran commented 4 years ago

@thernstig A breaking change, yes, but implementation-wise, just saving to a different directory, right?

thernstig commented 4 years ago

Yes, that should be all there is to it.

jorgebucaran commented 4 years ago

@thernstig Sounds good to me.

jorgebucaran commented 4 years ago

@thernstig Feel free to send me a PR.

thernstig commented 4 years ago

Any chance it could stay open till I do? :)

jorgebucaran commented 3 years ago

@thernstig I think this got closed when I migrated to the main branch, otherwise I don't know why I closed this. I'll make sure to use XDG_DATA_HOME in 2.0.

jorgebucaran commented 3 years ago

I just released 2.0. Now we're using XDG_DATA_HOME to store nvm's state: version binaries, and the download index file.