Properly outputting the version when nvm_version_path outputs the new "versions" subdirectory.
diff --git a/nvm.sh b/nvm.sh
index 64cdd33..652f3ba 100644
--- a/nvm.sh
+++ b/nvm.sh
@@ -988,7 +988,7 @@
echo "$VERSION version is not installed yet" >&2
return 1
fi
- echo $NVM_DIR/$VERSION/bin/node
+ echo "$NVM_VERSION_DIR/bin/node"
;;
"alias" )
mkdir -p "$NVM_DIR/alias"
diff --git "a/test/fast/Listing paths/Running \"nvm which 0.0.2\" should display only version 0.0.2." "b/test/fast/Listing paths/Running \"nvm which 0.0.2\" should display only version 0.0.2."
index a39a456..7b410c5 100755
--- "a/test/fast/Listing paths/Running \"nvm which 0.0.2\" should display only version 0.0.2."
+++ "b/test/fast/Listing paths/Running \"nvm which 0.0.2\" should display only version 0.0.2."
@@ -1,7 +1,8 @@
#!/bin/sh
-mkdir ../../../v0.0.2
-mkdir ../../../v0.0.20
+mkdir -p ../../../v0.0.2
+mkdir -p ../../../v0.0.20
+mkdir -p ../../../versions/v0.12.0
. ../../../nvm.sh
@@ -9,13 +10,18 @@
# The result should contain only the appropriate version numbers.
-nvm which 0.0.2
-nvm which 0.0.2 | grep "$NVM_DIR/v0.0.2/bin/node" > /dev/null
-if [ $? -ne 0 ]; then
- die '"nvm which 0.0.2" did not contain the correct path'
-fi
+nvm which 0.0.2 || die "v0.0.2 not found"
+NVM_BIN="$(nvm which 0.0.2)"
+[ "_$NVM_BIN" = "_$(nvm_version_path v0.0.2)/bin/node" ] \
+ || die "'nvm which 0.0.2' did not contain the correct path: got '$NVM_BIN'"
-nvm which 0.0.20 | grep "$NVM_DIR/v0.0.20/bin/node" > /dev/null
-if [ $? -ne 0 ]; then
- die '"nvm which 0.0.2" did not contain the correct path'
-fi
+nvm which 0.0.20 || die "v0.0.20 not found"
+NVM_BIN="$(nvm which 0.0.20)"
+[ "_$NVM_BIN" = "_$(nvm_version_path v0.0.20)/bin/node" ] \
+ || die "'nvm which 0.20.0' did not contain the correct path: got '$NVM_BIN'"
+
+nvm which 0.12.0 || die "v0.0.20 not found"
+NVM_BIN="$(nvm which 0.12.0)"
+[ "_$NVM_BIN" = "_$(nvm_version_path v0.12.0)/bin/node" ] \
+ || die "'nvm which 0.12.0' did not contain the correct path: got '$NVM_BIN'"
+
diff --git "a/test/fast/Listing paths/Running \"nvm which foo\" should return a nonzero exit code when not found" "b/test/fast/Listing paths/Running \"nvm which foo\" should return a nonzero exit code when not found"
index 43b2bae..4c4a301 100755
--- "a/test/fast/Listing paths/Running \"nvm which foo\" should return a nonzero exit code when not found"
+++ "b/test/fast/Listing paths/Running \"nvm which foo\" should return a nonzero exit code when not found"
@@ -3,4 +3,4 @@
. ../../../nvm.sh
nvm which nonexistent_version
-[ "$?" = "1" ]
+[ "_$?" = "_1" ]
diff --git a/test/fast/Listing paths/teardown b/test/fast/Listing paths/teardown
index 2bc7383..25277fe 100755
--- a/test/fast/Listing paths/teardown
+++ b/test/fast/Listing paths/teardown
@@ -1,2 +1,3 @@
rmdir ../../../v0.0.2 >/dev/null 2>&1
rmdir ../../../v0.0.20 >/dev/null 2>&1
+rmdir ../../../v0.12.0 >/dev/null 2>&1