-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Fix: XDG_CONFIG_HOME compatible #1888
Conversation
README.md
Outdated
@@ -52,10 +52,10 @@ or Wget: | |||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | |||
``` | |||
|
|||
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub> | |||
<sub>The script clones the nvm repository to `$XDG_CONFIG_HOME/nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still leave this as ~/.nvm
, but maybe clarify that it will go inside $XDG_CONFIG_HOME
if present, otherwise will fall back to $HOME
.
(also, you've lost the </sub>
here)
README.md
Outdated
|
||
```sh | ||
export NVM_DIR="$HOME/.nvm" | ||
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/config}/nvm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like it'd put it in either $XDG_CONFIG_HOME/nvm
, or $HOME/config/nvm
- however, the locations i'd expect are $XDG_CONFIG_HOME/.nvm
or $HOME/.nvm
.
install.sh
Outdated
elif [ ! -z "$XDG_CONFIG_HOME" ]; then | ||
printf %s "${XDG_CONFIG_HOME/nvm/}" | ||
else | ||
printf %s "${HOME/.config/nvm/}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inside the home dir, it must be .nvm
directly inside $HOME
- there's no .config
directory convention i'm interested in or aware of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not clear why the folder name should be "nvm" and not ".nvm" inside the XDG config folder. Can you explain?
README.md
Outdated
@@ -52,10 +52,12 @@ or Wget: | |||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | |||
``` | |||
|
|||
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub> | |||
<sub>The script clones the nvm repository to `$HOME/nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.nvm
not nvm
nvm.sh
Outdated
nvm_echo "${legacy_nvm_dir}/.nvmrc" | ||
fi | ||
if [ -e "${XDG_CONFIG_HOME}/nvm/.nvmrc" ]; then | ||
nvm_echo "${XDG_CONFIG_HOME}/nvm/.nvmrc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will print out two lines if both locations exist.
I'm not actually sure why this is being changed; .nvmrc
doesn't work currently inside $NVM_DIR
when it's $HOME/.nvm
; i'm not sure why it'd start working inside the XDG folder. If you want a global default, you'd do nvm alias default whatever
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps then the way forward is figuring out why .nvmrc
doesn't work inside the $NVM_DIR
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's not supposed to work inside there. It's an rc file - it goes in the directory hierarchy, and $NVM_DIR
isn't part of the hierarchy.
Going by what i'm currently seeing my own
Granted I don't have a lot of folders here, but there doesn't seem to be any folders that keep the dot-prefix before the folder names here. |
Interesting; I'm not super familiar with XDG but if that's the convention then that's fine. |
Don't understand why the other test cases are failing. Could anyone help me out? |
I've got a fix in your PR #1891, thanks. Will merge once that's passed. |
Anything else you need for a merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! just one question.
Fixes #1088, fixes #1882.
I haven't really tried it, so would be good if someone tried it at least.