Hey,
I tried to install nvm according to the README and my environment contains a few XDG variables, like
declare -x XDG_CACHE_HOME="$HOME/.cache"
declare -x XDG_CONFIG_HOME="$HOME/.config"
declare -x XDG_DATA_HOME="$HOME/.local/share"
The installation (using bash) took place inside of the .config directory - was used as root Git directory. Could it be possible that /nvm should not be part of the variable scoping - bash parameter substitution?
https://github.com/creationix/nvm/blob/2410215b6a96c5a4376af8a41b6e2942b4b6cc2d/install.sh#L11
$ echo "${XDG_CONFIG_HOME}"
$HOME/.config
$ echo "${XDG_CONFIG_HOME/nvm}"
$HOME/.config
$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Cheers
That seems like a likely typo indeed :-)
I stumbled upon this right now, too. On Raspbian Buster XDG_CONFIG_HOME is set to /home/pi/.config making NVM install itself to .config and as a consquence breaking a script of mine, that should setup NVM+Node.
Another note:
$XDG_CONFIG_HOMEdefines the base directory relative to which user specific configuration files should be stored. If$XDG_CONFIG_HOMEis either not set or empty, a default equal to$HOME/.configshould be used. (spec)
nvm should not require the variable to be defined in order to act in a XDG-compliant way.
I'm not interested in complying to that level with XDG; nvm's config is stored in $HOME/.nvm. Overriding $NVM_DIR, or setting XDG variables, is a niche and power user feature that I'm happy to support - but the defaults won't be changed.
Separately, the spec says "should", not "must", which means it's not mandatory to do so - so nvm isn't in violation of the XDG spec here.
:ok_hand:
Non-power users are the ones that benefit most from defaults, and it seems like an easy step towards a tidier world, but I do appreciate that there's a lot of ~/.nvm out there already ...
but I do appreciate that there's a lot of
~/.nvmout there already ...
I don't get it, respecting XDG spec just make your stuff much cleaner, there is already enough programs that are not compliant, which makes you always looking for workarounds.
Cleaner is subjective - i don’t find it cleaner for myself.
Most helpful comment
I don't get it, respecting XDG spec just make your stuff much cleaner, there is already enough programs that are not compliant, which makes you always looking for workarounds.