nodeswitch 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,10 +19,25 @@ if not "%1" == "" (
19
19
  ) else (
20
20
  if exist %AppData%\nodeswitch\%2 (
21
21
  if not defined nodeswitchDefaultPATH (
22
- set "nodeswitchDefaultPATH=%PATH%"
23
- set "PATH=%PATH:C:\Program Files\nodejs\;=%;%AppData%\nodeswitch\%2"
22
+ if not "%PATH:C:\Program Files\nodejs\;=%" == "%PATH%" (
23
+ set "nodeswitchDefaultPATH=%PATH%"
24
+ set "nodeswitchTypePATH=1"
25
+ set "PATH=%PATH:C:\Program Files\nodejs\;=%;%AppData%\nodeswitch\%2"
26
+ ) else if not "%PATH:C:\Program Files\nodejs\=%" == "%PATH%" (
27
+ set "nodeswitchDefaultPATH=%PATH%"
28
+ set "nodeswitchTypePATH=2"
29
+ set "PATH=%PATH:C:\Program Files\nodejs\=%%AppData%\nodeswitch\%2"
30
+ ) else (
31
+ echo System environment variable Path doesn't include C:\Program Files\nodejs\
32
+ )
24
33
  ) else (
25
- set "PATH=%nodeswitchDefaultPATH:C:\Program Files\nodejs\;=%;%AppData%\nodeswitch\%2"
34
+ if "%nodeswitchTypePATH%" == "1" (
35
+ set "PATH=%nodeswitchDefaultPATH:C:\Program Files\nodejs\;=%;%AppData%\nodeswitch\%2"
36
+ ) else if "%nodeswitchTypePATH%" == "2" (
37
+ set "PATH=%nodeswitchDefaultPATH:C:\Program Files\nodejs\=%%AppData%\nodeswitch\%2"
38
+ ) else (
39
+ echo System environment variable Path doesn't include C:\Program Files\nodejs\
40
+ )
26
41
  )
27
42
  ) else (
28
43
  echo Node version not installed
@@ -20,11 +20,25 @@ if ( $nodeswitch1stParameter -ne $null ) {
20
20
  } else {
21
21
  if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
22
22
  if ( $global:nodeswitchDefaultPATH -eq $null ) {
23
- $global:nodeswitchDefaultPATH = $env:Path
24
- $env:Path = cmd /c "echo %PATH:C:\Program Files\nodejs\;=%;$env:AppData\nodeswitch\$nodeswitch2ndParameter"
23
+ if ( $env:path -like "*C:\Program Files\nodejs\;*" ) {
24
+ $global:nodeswitchDefaultPATH = $env:Path
25
+ $env:Path = cmd /c "echo %PATH:C:\Program Files\nodejs\;=%;$env:AppData\nodeswitch\$nodeswitch2ndParameter"
26
+ } elseif ( $env:path -like "*C:\Program Files\nodejs\*" ) {
27
+ $global:nodeswitchDefaultPATH = $env:Path
28
+ $env:Path = cmd /c "echo %PATH:C:\Program Files\nodejs\=%$env:AppData\nodeswitch\$nodeswitch2ndParameter"
29
+ } else {
30
+ echo "System environment variable Path doesn't include C:\Program Files\nodejs\"
31
+ }
25
32
  } else {
26
- $env:Path = echo $global:nodeswitchDefaultPATH
27
- $env:Path = cmd /c "echo %PATH:C:\Program Files\nodejs\;=%;$env:AppData\nodeswitch\$nodeswitch2ndParameter"
33
+ if ( $global:nodeswitchDefaultPATH -like "*C:\Program Files\nodejs\;*" ) {
34
+ $env:Path = echo $global:nodeswitchDefaultPATH
35
+ $env:Path = cmd /c "echo %PATH:C:\Program Files\nodejs\;=%;$env:AppData\nodeswitch\$nodeswitch2ndParameter"
36
+ } elseif ( $global:nodeswitchDefaultPATH -like "*C:\Program Files\nodejs\*" ) {
37
+ $env:Path = echo $global:nodeswitchDefaultPATH
38
+ $env:Path = cmd /c "echo %PATH:C:\Program Files\nodejs\=%$env:AppData\nodeswitch\$nodeswitch2ndParameter"
39
+ } else {
40
+ echo "System environment variable Path doesn't include C:\Program Files\nodejs\"
41
+ }
28
42
  }
29
43
  } else {
30
44
  echo "Node version not installed"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodeswitch",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Node version switcher for Microsoft Windows x64",
5
5
  "scripts": {
6
6
  "preinstall": "node scripts/preinstall.js",