From 0a695c5d2a85c0613ea088bd9ebb7acaae95fa77 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 20 Aug 2014 00:18:29 -0700 Subject: [PATCH] Modify nvm_version_path to use nvm_version_greater. --- nvm.sh | 4 +++- test/fast/Unit tests/nvm_version_path | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index 8860919..f5216b1 100644 --- a/nvm.sh +++ b/nvm.sh @@ -122,8 +122,10 @@ nvm_version_path() { if [ -z "$VERSION" ]; then echo "version is required" >&2 return 3 - elif [ ! -z "$VERSION" ]; then + elif nvm_version_greater 0.12.0 "$VERSION"; then echo "$(nvm_version_dir old)/$VERSION" + else + echo "$(nvm_version_dir new)/$VERSION" fi } diff --git a/test/fast/Unit tests/nvm_version_path b/test/fast/Unit tests/nvm_version_path index ba38e37..b9fa2e5 100755 --- a/test/fast/Unit tests/nvm_version_path +++ b/test/fast/Unit tests/nvm_version_path @@ -6,4 +6,6 @@ die () { echo $@ ; exit 1; } [ "$(nvm_version_path foo)" = "$NVM_DIR/foo" ] || die '"nvm_version_path foo" did not return correct location' [ "$(nvm_version_path 2>&1)" = "version is required" ] || die '"nvm_version_path" did not error out' +[ "$(nvm_version_path v0.11.0)" = "$NVM_DIR/v0.11.0" ] || die 'old version has the wrong path' +[ "$(nvm_version_path v0.12.0)" = "$NVM_DIR/versions/v0.12.0" ] || die 'new version has the wrong path'