Fix `nvm_strip_path` for >= v0.12.0 node, and all io.js versions.

master
Jordan Harband 2015-01-18 23:55:26 -08:00
parent 39a75e616d
commit dbeeb683da
2 changed files with 8 additions and 2 deletions

8
nvm.sh
View File

@ -264,7 +264,13 @@ nvm_num_version_groups() {
}
nvm_strip_path() {
echo "$1" | command sed -e "s#$NVM_DIR/[^/]*$2[^:]*:##g" -e "s#:$NVM_DIR/[^/]*$2[^:]*##g" -e "s#$NVM_DIR/[^/]*$2[^:]*##g"
echo "$1" | command sed \
-e "s#$NVM_DIR/[^/]*$2[^:]*:##g" \
-e "s#:$NVM_DIR/[^/]*$2[^:]*##g" \
-e "s#$NVM_DIR/[^/]*$2[^:]*##g" \
-e "s#$NVM_DIR/versions/[^/]*/[^/]*$2[^:]*:##g" \
-e "s#:$NVM_DIR/versions/[^/]*/[^/]*$2[^:]*##g" \
-e "s#$NVM_DIR/versions/[^/]*/[^/]*$2[^:]*##g"
}
nvm_prepend_path() {

View File

@ -4,7 +4,7 @@ die () { echo $@ ; exit 1; }
. ../../../nvm.sh
TEST_PATH=$NVM_DIR/v0.10.5/bin:/usr/bin:$NVM_DIR/v0.11.5/bin:$NVM_DIR/v0.9.5/bin:/usr/local/bin:$NVM_DIR/v0.2.5/bin
TEST_PATH=$NVM_DIR/v0.10.5/bin:/usr/bin:$NVM_DIR/v0.11.5/bin:$NVM_DIR/v0.9.5/bin:/usr/local/bin:$NVM_DIR/v0.2.5/bin:$NVM_DIR/versions/node/v0.12.0/bin:$NVM_DIR/versions/io.js/v1.0.0/bin
STRIPPED_PATH=`nvm_strip_path "$TEST_PATH" "/bin"`