[Refactor] clean up `nvm_sanitize_path`

Jordan Harband 2016-05-05 23:52:26 -07:00
parent 06c1cfcd85
commit d1962c6742
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 7 additions and 4 deletions

11
nvm.sh
View File

@ -1633,11 +1633,14 @@ nvm_has_solaris_binary() {
nvm_sanitize_path() {
local SANITIZED_PATH
SANITIZED_PATH="$1"
if [ "_$1" != "_$NVM_DIR" ]; then
SANITIZED_PATH="$(nvm_echo "$SANITIZED_PATH" | command sed "s#$NVM_DIR#\$NVM_DIR#g")"
SANITIZED_PATH="${1-}"
if [ "_$SANITIZED_PATH" != "_$NVM_DIR" ]; then
SANITIZED_PATH="${SANITIZED_PATH/#$NVM_DIR/\$NVM_DIR}"
fi
nvm_echo "$SANITIZED_PATH" | command sed "s#$HOME#\$HOME#g"
if [ "_$SANITIZED_PATH" != "_$HOME" ]; then
SANITIZED_PATH="${SANITIZED_PATH/#$HOME/\$HOME}"
fi
nvm_echo "$SANITIZED_PATH"
}
nvm_is_natural_num() {