File tree Expand file tree Collapse file tree 4 files changed +22
-3
lines changed
Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 1818! /tools /
1919! /setup /
2020! /chocolatey /
21+ ! /homebrew /
2122
2223# Temporary files generated during testing
2324/test /temp
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ NVS_DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd)
4+
5+ # Set environment variables
6+ export HOME=~
7+ export NVS_HOME=~ /.nvs
8+
9+ # Run install script
10+ \. $NVS_DIR /nvs.sh install
Original file line number Diff line number Diff line change @@ -145,24 +145,32 @@ function getShellProfile() {
145145}
146146
147147function installToShellProfile ( profileFile ) {
148+ let rootPathAbs = path . resolve ( __dirname , '..' ) ;
149+ let homePathAbs = path . resolve ( settings . home ) ;
150+
151+ let rootPath = nvsUse . homePath ( rootPathAbs ) . replace ( '~' , '$HOME' ) ;
148152 let homePath = nvsUse . homePath ( settings . home ) . replace ( '~' , '$HOME' ) ;
149153 if ( homePath . endsWith ( '/' ) || homePath . endsWith ( '\\' ) ) {
150154 homePath = homePath . substr ( 0 , homePath . length - 1 ) ;
151155 }
152156
157+ if ( rootPathAbs === homePathAbs ) {
158+ rootPath = '$NVS_HOME' ;
159+ }
160+
153161 const installLines = isMingwBash
154162 ? [
155163 'function setupNvs {' ,
156164 ' export NVS_HOME="' + homePath + '";' ,
157- ' [ -s "$NVS_HOME /nvs.sh" ] && source "$NVS_HOME /nvs.sh" >> /dev/null;' ,
165+ ' [ -s "' + rootPath + ' /nvs.sh" ] && source "' + rootPath + ' /nvs.sh" >> /dev/null;',
158166 ' return 0;' ,
159167 '}' ,
160168 'setupNvs' ,
161169 ]
162170 // normal POSIX shell
163171 : [
164172 'export NVS_HOME="' + homePath + '"' ,
165- '[ -s "$NVS_HOME /nvs.sh" ] && . "$NVS_HOME /nvs.sh"' ,
173+ '[ -s "' + rootPath + ' /nvs.sh" ] && . "' + rootPath + ' /nvs.sh"',
166174 ] ;
167175
168176 if ( ! profileFile ) {
Original file line number Diff line number Diff line change 11{
22 "name" : " nvs" ,
3- "version" : " 1.6.1 " ,
3+ "version" : " 1.6.2 " ,
44 "description" : " Node Version Switcher" ,
55 "main" : " lib/index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments